Redux vs Flux

Gina Yeon
Gina Yeon
Feb 19, 2017 · 2 min read

Going into Redux, I wanted to see the difference in patterns between the two.

The general gist of Redux is that the entire state of your app is stored in an object tree inside a single store. The only way to change the state tree is to emit an action (object). Pure reducers will then specify how those actions transform the state tree.

The single major difference between Flux and Redux is that Redux doesn’t have a Dispatcher, or support many stores. Instead, there is just a single store with a single root reducer.

Image for post
Image for post

Action creators in Redux differ from action creators in Flux by forgoing sending the action to the dispatcher, and instead returning a formatted action object to the store.

The store delegates the work to the reducers by sending them what specific state change they need to update.

The root reducer will split the actions up and send it to the respective reducer. Instead of changing the state completely, they make a copy of the current state, and send back the state changes made on that copy.

The smart components are in charge of the actions. They essentially tell the dumb components what to do by passing a function to them via props. The dumb components, or presentational components are mainly in charge of laying out DOM elements.

The view layer binding connects the store to the views by introducing three concepts:

  • The Provider component — uses the connect() method to link up the component’s children to the store.
  • Connect() — is a function that will set up all the wiring to get state updates using the selector.
  • Selector — specifies what parts of the state a component needs as properties.

It will then trigger a re-render updating all the state changes in the views.


Cartoon Intro to Redux

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store