Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Point 2 in this article says a global store is the solution to its example problem. If there are any details of the example problem that make a global store the best solution, those details are not given. Generally you store a component's state in the component, and store shared state in a common ancestor of the components that share it.


Yeah, he didn't do the best job of explaining why in that example.

Using a global store makes sense when your todo list evolves and the component storing the data is no longer mounted / exists. Examples could be:

- Full page individual todo edit - Separate component / page that uses the same data - Some background logic that does X based on the todo data




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: