3 ms·
A lot depends on the complexity of your application. There are some simple React applications where you can keep the state near the top of the application and
by PaulHoule 4y ago
A lot depends on the complexity of your application.
There are some simple React applications where you can keep the state near the top of the application and let it percolate into the components via props. (Like my app for controlling my smart speakers.) In a case like that framework can be part of the problem as much as a solution.
When you've got complex state all over the place and an update to component A's data can cause component B and C to update and particularly if the app is dynamic so you don't know when you're writing it exactly what will cause what to update than you really need a framework.
- nightski 4y agoHonestly I'd argue you don't. I like the explicit nature of top down state and passing down actions via props because then you can see directly, via props, what mutates what. I've built quite sophisticated applications that involve financial forecasting, logistics planning, etc.. using exactly this technique. It also gives you the ability to use local state when it makes sense. You really don't need the intermediate state of a text input at the top level state for example.