News for hackers. Stuff that matters.
Re:Overmind.js – Frictionless State Management by ZephyrBlu on Monday October 12, 2020 @08:21AM (#24753658)
This is definitely not true, especially if you co-locate your data fetching in your reducers, which is a common pattern.

It also provides a single, centralized store instead of needing many context's and lets you abstract data shape/formatting logic away instead of having it in your application.

Context and State are great, but they serve a different purpose than Redux.

Re:Overmind.js – Frictionless State Management by chansiky on Monday October 12, 2020 @10:42AM (#24754794)
Having used hooks to replace my state at some point I couldn't agree more. Application state should not be dependent on components, rather components should be dependent on application state.

My recommendation is keep hooks and contexts for ui state only, like form fields/validations, modal popups, drawer collapse, filter options, etc, but for things dealing with more general application state which the ui will display, like user information, products list, project data, application settings, etc, a separable state machine should be used. This works well because components are responsible for their own state leaving the state manager clean from individual ui component information, and ui components are free to be passed whatever data improving reusability.

Re:Overmind.js – Frictionless State Management by Emanation on Monday October 12, 2020 @11:59AM (#24755784)
Why should a seperate state machine be used? Redux doesn't magically seperate state information from the tree. It's built upon react context/provider system, which in effect can be seen as a component.

The special sauce, in regards to seperation, is that it can be wired into the component tree without passing it down, which is a property of provider/context and not redux itself.

Re:Overmind.js – Frictionless State Management by jeswin on Monday October 12, 2020 @02:13PM (#24757508)
> Application state should not be dependent on components

Sorry, I don't follow. When using Context, how does the application state become dependent on Components any more than it is with Redux? You can accomplish pretty much the same thing with far less code.

Can you provide an example?

Re:Overmind.js – Frictionless State Management by jeswin on Monday October 12, 2020 @02:10PM (#24757475)
> This is definitely not true, especially if you co-locate your data fetching in your reducers, which is a common pattern.

How can it be definitely not true, when you have to say "especially"? Most code I've seen (including the official docs) don't data fetch in reducers. But even then, I'm not sure what you mean.

> It also provides a single, centralized store instead of needing many contexts...

Which you can very well do with useContext and useState.