> A stateful function with effects. Your language just doesn’t have a primitive to express it.
I wonder what about generator functions?
I wonder what about generator functions?
I'd be surprised if generators didn't come into React at one point or another
"stateful": A function that has state, i.e. can store data
"with effects": A function that modifies data outside its own scope
Normal JS functions (as opposed to arrow function) already do this:
function foo(){};
foo.state = bar;
Generator functions take it a step further, where the function remembers internal state between calls.