5 ms·
I wonder why people need Redux, Using simply React is great and enough if you understand it well
by caub 10y ago
I wonder why people need Redux, Using simply React is great and enough if you understand it well
- exception_e 10y agoReact is just the UI piece of the puzzle. Here's a nice description of when to use Redux: "[Redux is justified when] you have a piece of data that needs to be used in multiple places in your app, and passing it via props makes your components break the single-responsibility principle (i.e. makes their interface make less sense)" (https://github.com/petehunt/react-howto/issues/12#issuecomment-169546558 https://github.com/petehunt/react-howto/issues/12#issuecomme...) This comment was written for Flux, but it is completely applicable for Redux. When building something non-trivial, there are other pieces you'll want to pull in with React such as routing, messaging, etc.
- caub 10y agoYea I know what Flux, Redux are, and honestly I think they are completely not needed if you understand and use React well, see comment below
- ulisesrmzroche 10y agoNo it's not. You can't communicate cross components with just react, you're stuck on a parent-child relationship.
- caub 10y agoyou can by passing right state to the closest common parent. I pass props down, and a custom update function, easy, efficient (with PureComponents)