Thinking in Events

  1. Enumerated actions that describe all possible events (Not setters) that your Redux setup will handle.
  2. A side effect manager where you can resolve side effects such as network requests, interactions with local/session storage, etc.
  3. Reducers which are supposed to house pure logic. In other words, you’re supposed to do more than just update state here. The Redux style guide has this helpful quote:
    “Wherever possible, try to put as much of the logic for calculating a new state into the appropriate reducer, rather than in the code that prepares and dispatches the action”
  4. Selectors which interpret state in terms of how it will impact your component. So put as much logic as necessary here. Prefer to have more selectors rather than fewer and make each one describe impacts that are as specific as is reasonable. This makes it much easier to think about future changes to your application.
Bidirectional vs Unidirectional State Flow

--

--

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
Rob Bertram

Rob Bertram

“A language that doesn’t affect the way you think about programming is not worth knowing.”