16 ms·
Yep, sorry I should have included the reference. This post is by the redux-form creator, in which he states why it was a bad idea, and announces its 'spiritual
by allover 8y ago
Yep, sorry I should have included the reference. This post is by the redux-form creator, in which he states why it was a bad idea, and announces its 'spiritual successor': https://codeburst.io/final-form-the-road-to-the-checkered-flag-cd9b75c25fe https://codeburst.io/final-form-the-road-to-the-checkered-fl...
> Also, everyone high up in the React community, including both inventors of Redux [1], say that Redux is not the best place to keep form data. Oops.
[1] https://github.com/reactjs/redux/issues/1287#issuecomment-175351978 https://github.com/reactjs/redux/issues/1287#issuecomment-17...
- acemarke 8y agoNow, it _does_ depend on your use case. An isolated login form? Yeah, no point keeping that in Redux - it's not being shared, it's not being persisted, there's no real need to track the history of changes. But, there are certainly situations where you might want to keep some form data in Redux. As a specific example from my own app: we show some polylines on a 3D globe, and allow the user to edit them. We need to be able to live-update the point locations and labels on the globe as the user edits them, allow resetting edits, and still be able to show the original values elsewhere in the UI. Keeping all that data in Redux makes it easy to do so. The Redux FAQ has a list of suggested rules of thumb for deciding what state should go in Redux: https://redux.js.org/faq/organizing-state#do-i-have-to-put-all-my-state-into-redux-should-i-ever-use-reacts-setstate https://redux.js.org/faq/organizing-state#do-i-have-to-put-a... .
- mosdl 8y agoYou can achieve all of that with a singleton that is shared and some events (and do some of your own batching). No need for another dependency and you save bloat size.
- deleted 8y ago[deleted]
- acemarke 8y agoWell, the whole app is built around Redux in the first place :)
- drunknhik 8y agoTo me this underscores the most unspoken point. Redux is meant for when you specifically want to build your app around redux. It's not meant to tack on some global store to an existing UI. It is UI agnostic way of separating your business logic and side effects from the UI iself (which could be react, vue, angular, whatever)
- acemarke 8y agoFor the most part, yeah. Now, the other app my team works on is built with Backbone/Marionette. We've introduced React and Redux to it, and are progressively refactoring over time. It works, although we've got some rather ugly code in several places (some data is in Backbone collections, other data is in Redux, and occasionally some bits of data are mirrored in both places). I wrote about some of the techniques we're using to integrate them here: https://blog.isquaredsoftware.com/2017/07/react-redux-backbone-integration/ https://blog.isquaredsoftware.com/2017/07/react-redux-backbo...