3 ms·
Now I have to change all my Redux reducers!
by giacomorebonato 7y ago
Now I have to change all my Redux reducers!
- antihero 7y agoNot sure if sarcastic comment, but this would entirely break how redux works.
- lenticular 7y agoI probably wouldn't worry about it unless you have really large arrays. It's still probably pretty insignificant compared to the time spent updating the DOM.
- _bxg1 7y agoRedux is designed to be used with this kind of pattern. Immutable.js, which is often paired with it, mostly solves this particular type of performance problem. You'll still have a performance ceiling when you use Redux, but it's very unlikely that you'll hit it. Edit: I was using Immutable.js as a stand-in for immutable data structures in general; apparently there are other JS libraries you can use
- acemarke 7y agoHi, I'm a Redux maintainer. I personally would recommend _against_ using Immutable.js, for a number of reasons [0]. Instead, I highly recommend the Immer library [1], which lets you do immutable updates with "mutating" logic in callbacks. Even better, try out our new Redux Starter Kit package. It uses Immer internally to let you simplify immutable updates in your reducers [2]. [0] https://www.reddit.com/r/javascript/comments/4rcqpx/dan_abramov_redux_is_not_an_architecture_or/d51g4k4?context=3 https://www.reddit.com/r/javascript/comments/4rcqpx/dan_abra... [1] https://github.com/immerjs/immer https://github.com/immerjs/immer [2] https://redux-starter-kit.js.org/ https://redux-starter-kit.js.org/
- seattle_spring 7y agoYikes, please no. Mutating your state will put you in a world of hurt.