4 ms·
For a simple app your code works fine. You will have trouble when it scales. We have migrated a load of model logic from Angular to redux and redux saga, once
by roughcoder 10y ago
For a simple app your code works fine. You will have trouble when it scales.
We have migrated a load of model logic from Angular to redux and redux saga, once you get your head around a nice structure then its a dream.
I created a gist for you to check out [1]. Maybe also check out the concept of Redux Ducks [2]. I now find our code easy to read, share and test - unlike our massive Angular app.
Also as somebody else comments, you should make sure the only way you talk to your store is through a reducer dispatcher.
Regarding component states, find some reading on components v containers [3] - we even have 2 separate folders for the different types. Once mastered and implemented, most components are small and again easy to test.
[1] https://gist.github.com/anonymous/a20f603f9922742bd3cea7a08cbe86bd https://gist.github.com/anonymous/a20f603f9922742bd3cea7a08c...
[2] https://github.com/erikras/ducks-modular-redux https://github.com/erikras/ducks-modular-redux
[3] https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0 https://medium.com/@dan_abramov/smart-and-dumb-components-7c...
- pavlov 10y agoI don't know. It looks like a lot of boilerplate just to tag a tiny bit of metadata onto a function pointer... I guess I'll need to do some more reading on how this works in larger applications with more complex model structures. Thanks for the links!
- acemarke 10y agoFYI, I've got links to a number of actual Redux-based applications at https://github.com/markerikson/redux-ecosystem-links/blob/master/apps-and-examples.md https://github.com/markerikson/redux-ecosystem-links/blob/ma... , including Jenkins' new management UI, Firefox's new debugger, Wordpress's new admin page, the popular HyperTerm terminal application, and more. Twitter's mobile page is also built with React and Redux.
- hfourm 10y agoWe have an pretty large production app w/ React & Redux. In some ways it is initially a lot of boilerplate for various state reducers, but after everything is there building really functional features is extremely quick with redux; just from a developer's time point of view.