× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Use flux to handle your state and simplify your React logic!

<p><em>React components can grow in complexity very quickly!</em></p> <p> </p> <p>Managing internal state is fine for very small things but when your applications grows, and your start connecting a few components, trying to make sense of how everything works together or which component is responsible for what piece of data all of the sudden<span style="color:rgb(95, 99, 102)"> isn't that</span> straight forward anymore!</p> <p> </p> <p><em>That's when flux comes to the rescue!</em></p> <p>So, instead of defining states in your components, just push that responsibility to "stores" and "actions".</p> <p><span style="color:rgb(95, 99, 102)">At its heart, t</span>he concept is very simple:</p> <p>- when something changes, components trigger actions indicating what happened;</p> <p>- those actions get picked up by stores/reducers which transform their state based on what you tell it to do; and </p> <p>- finally views pick up the new state because they're connected to the store's state changes.</p> <p> </p> <p>So how do you <strong>Flux</strong>?</p> <p>There are tons of Flux implementation. The one that really makes a difference is <a href="https://github.com/gaearon/redux">Redux</a>. It has a minimal footprint and, more importantly, it lets you define your actions and reducers in raw JS. And that's only the tip of the iceberg!</p>
comments powered by Disqus