1
To be more precise, I have a react app with a bunch of 'elements' that you can perform operations on. I keep them in a global state array, access them by index, and perform operations based on their type. Is it worth having an oop class hierarchy with each 'element' component containing an instance of their corresponding 'element' class that implements the logic? This will result in getting rid of the switch statement on 'element' type but will add an instance of a class to each component. Is the memory overhead worth it?
TLDR: adding a class instance to every react component or keeping the switch statements?