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

Flux & Redux

Ángel M
November 02, 2016

Flux & Redux

Flux is proposed by people as the replacement of MVC in Frontend projects. However, Flux is a new application structure or design pattern so both patterns have different approaches and solve different problems. Discover the difference between Flux and MVC and learn about Redux, a functional and reactive implementation of Flux.

Ángel M

November 02, 2016
Tweet

More Decks by Ángel M

Other Decks in Programming

Transcript

  1. Confidential Store Key Value messages [...] user { ... }

    readMessage Key Value messages [...]* user { ... }
  2. Confidential Redux • Reactive Flux implementation • Based on functional

    principles • Predictable. Easy to test • Lightweight (~600 loc) • Has integrations with a lot of frameworks
  3. Confidential Why Flux? • Easy to share data in your

    application • Reuse business logic • Predictable. The data is only updated by dispatchers • Scalable • Developer friendly
  4. Confidential Why Redux? • Reactive • TDD • Pre-fill your

    initial state • Store the state in localStorage • Every version of the state is an snapshot of the application
  5. Confidential Why not Flux? • Define your state and changes

    in your application as plain objects • To modify the state, you need to create an action and a dispatcher (complexity) • Sync problems on retrieving and modifying. Flux is sync.
  6. Confidential Why not Redux? • Last slide • All the

    business logic should be pure • The state is immutable. Good for me, but you need to write more code or use ImmutableJS.