Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What is Redux (vs. MVC)

What is Redux (vs. MVC)

Presentation given to the local team at @MessageMedia

Callum Silcock

January 30, 2018
Tweet

More Decks by Callum Silcock

Other Decks in Technology

Transcript

  1. Analogies • Ac$ons = Controller • Whenever you want something

    to happen dispatch an ac$on • Just like when you would call the controller • Reducer = Model (kind of) • Reducers hold the current state of the applica$on • Also decides what to do when you call the ac$on • in MVC you might have a model with the method setName(),
  2. Huh? One of the main differences between MVC and Redux

    is that, while in MVC data can flow in a bidirec<onal manner, in Redux it strictly moves in one direc<on.
  3. The state • Like having a big set of data

    for the en3re applica3on • Javascript object • Cannot be modified directly (read only and immutable) • Changes are made with actions • Predictable changes • Logged • Obvious
  4. Let’s start Live code example within our applica4on • Define

    ac)on • Define reducer • Add ac)on as prop in component • Wire it up in the view
  5. Resources • Thinking in Redux when all you've known is

    MVC • Ge:ng started with redux • React applica?ons with idoma?c redux