3 ms·
The question I ask when deciding between component state (via setState) or application state (via hoisting / redux / mobx) is simply whether the state is releva
by sudhirj 9y ago
The question I ask when deciding between component state (via setState) or application state (via hoisting / redux / mobx) is simply whether the state is relevant to the application as a whole.
One example is the text I’m currently typing - that would only be relevant at a component level, maybe including an adjoining word counter. Once I hit reply, though, it becomes part of the application state.
An exception would be if I was continuously storing what was typed for offline use - in that case it’s always application state.