You had me at Redux

We use a lot of jQuery at iHerb. A. Lot.

One of the things that bug me about jQuery though, is that it's 'standard?' to store application state / data in the DOM. The DOM becomes a source of truth. Messy! But I guess that's the powerful thing (weakness?) of jQuery.

Recently I've been finding myself wondering about a cleaner way to store new data. "Just stick it in global, or stick it on to a data-attribute". But then I start wondering which becomes the canonical form to verify the final source of truth.

It would be muuuuch cleaner if the DOM was just a pure representation of the current state of the data.

Hello Redux

We're testing out some solutions though, and Redux (and React) is on the cards (which I'm personally very interested in!).

Some of the key wins that I see are:

  • Centralizes all application state in one store
  • A single, centralized, object store makes comprehending the data flow easier
  • Top level React container component is subscribed to the Redux store
  • Helps to avoid the complexity of handling interactions between multiple views / view-models stores
  • Possible to allow server rendering React components

Hopefully we'll begin to see some React/Redux at iHerb?

Duncan Leung

Front End Developer at

Irvine, CA

Subscribe to Duncan Leung: Javascript and Front End Development

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!