It's common practice to use classes when needing to hold state.
However, I'm wondering if it's the best approach when you don't need all the baggage OOP comes with like inheritance, etc...
Here is an example of how I would go about it without classes :
Do you think this is a good approach? If not, why?
EDIT: The question is meant to be general and not specific to a given framework or library. For something like React you use what is given by the library. There isn't much room for choice here.
Here is an example of how I would go about it without classes :
function makePlayer() {
}Do you think this is a good approach? If not, why?
EDIT: The question is meant to be general and not specific to a given framework or library. For something like React you use what is given by the library. There isn't much room for choice here.