Redux Reducers and Selectors
Redux Docs: Structuring Reducers
Comprehensive information on writing reducers and structuring data, covering reducer composition, use of
combineReducers, normalizing data, proper immutable updating, and more.
"Reducer composition without slicing state"
Discussion of ways to organize actions and reducer logic
Taking Advantage of
Examples of using
combineReducersmultiple times to produce a state tree, and some thoughts on tradeoffs in various approaches to reducer logic.
The Power of Higher-Order Reducers
A slideshow from the author of redux-undo and other libraries, explaining the concept of higher-order reducers and how they can be used
Modifying a Leaf of the Redux State Tree
Some useful observations on how to properly do deep immutable updates.
"How to dynamically load reducers for code splitting in a Redux application?"
Dan Abramov gives a basic exapmle of how to rebuild and replace the root reducer function at runtime
Inject reducer arbitrarily rather than top level for Redux store to replace reducer
A quick example of the basic approach to injecting additional reducers at runtime
State Snapshots in Redux
Describes a useful technique for saving copies of state slices on command, and re-applying those copies at a later point to ensure a known starting point for further actions.
"Problems with Flux"
Discusses the idea of having all state updates for an action listed in one place, vs spread throughout the store. Written shortly after the release of Redux, but definitely relevant.
Looks at structuring a reducer/state tree as "branches" and "leaves", and introduces the idea of an "interaction" to encapsulate all related state changes for a given action, with a library to implement the idea.
Reducer composition with Higher Order Reducers
Some great examples of writing small functions that can be composed together to perform larger specific reducer tasks, such as providing initial state, filtering, updating specific keys, and more.
Using Currying to Compose Reducers
Some short but helpful examples of how currying functions can be used to reuse reducer logic for similar use cases.
Higher Order Reducers - It just sounds scary
Explains how reducers can be composed like Lego bricks to create reusable and testable reducer logic.
Functional Redux Reducers with Ramda
Shows how to write a somewhat complex Redux reducer using only composition of functions from the Ramda library
A small trick to write clean reducers
Shows a contrived example of updating deeply nested state, and discusses use of
lodash/fpto simplify the update logic instead.
Dynamic Store Injection for Redux
A slideshow that demonstrates the basic approach for dynamically adding reducers at runtime.
State Snapshots with Redux
Describes a useful technique for saving known state values and using those to reset or restore an earlier state.
Code splitting Redux reducers
Comprehensive instructions on how to properly code-split reducers for dynamic loading at runtime.
Dynamic Redux Reducers
Demonstrates setting up the "async reducers" approach described by Dan Abramov, and adding reducers based on routes using HOCs to abstract the process.
Idiomatic Redux: Using Reselect Selectors for Performance and Encapsulation
Introduces the core concepts of using selector functions to derive data from a Redux store, memoizing functions for performance, how to use the Reselect library to create memoized selector functions, and advanced techniques for working with selectors when writing
ReactCasts #8: Selectors in Redux
A great overview of why and how to use selector functions to retrieve data from the store, and derive additional data from store values
React, Reselect, and Redux
An explanation of how Reselect's memoized selector functions are useful in Redux apps, and how to create unique selector instances for each component instance.
Use Selectors in Redux for Great Good
A short article explaining the importance of selectors, with a few examples of how they benefit applications and how to use them.
Reselect with Redux and React
A screencast that introduces the Reselect library and discusses why it's useful in Redux apps
Optimizing React Redux Application Development with Reselect
A good tutorial on Reselect. Covers the concept of "selector functions", how to use Reselect's API, and how to use memoized selectors to improve performance.
Usage of Reselect in a React-Redux Application
Discusses the importance of memoized selectors for performance, and good practices for using Reselect.
Redux: Up your game with selectors
A quick look at the benefits of using selector functions to encapsulate looking up data from the store.
Better Redux Selectors with Ramda
A long article that describes how to use the Ramda FP utility library to create selectors, including use of functional composition.
Selectors: Slice your concerns like butter!
A slideshow that discusses what selector functions are and why you would want to use them.
Reselect's Memoization in 3 Functions
A dive into the Reselect source code, with explanations of memoization concepts and how Reselect implements memoization.
Memoize-Immutable: efficient memoizer for Redux
Discusses principles of immutability and memoization, and a library they built to help memoize Redux data lookups
"Any deep-dive/advanced tutorials on reselect?"
Discussion on passing arguments to Reselect selectors, and how to use "factory functions" to define per-component selectors for Redux
Selectors in Redux are a MUST
Examples of how nested Redux state can be difficult to work with, how to separate and structure domain data and UI data, and how and why to write selectors that extract and reshape the data as needed for different parts of the application.
Be Selective With Your State
A helpful overview of when and why to use selectors and Reselect with Redux, some issues with using selectors in multiple components, and using
re-reselectto create "cached" selectors.
Scaling data selection on the client
Describes several reasons to use selector functions, and gives examples of writing selectors to handle normalized state.
Querying a Redux Store
A look at best practices for organizing and storing data in Redux, including normalizing data and use of selector functions.
Normalizing Redux Stores for Maximum Code Reuse
Thoughts on how normalized Redux stores enable some useful data handling approaches, with examples of using selector functions to denormalize hierarchical data.
Practical Redux: Using Redux-ORM
A look at how Redux-ORM can help manage normalized data in a Redux store, including use cases, basic usage, key concepts, and advanced techniques.
Advanced Redux Entity Normalization
Describes a "keyWindow" concept for tracking subsets of entities in state, similar to an SQL "view". A useful extension to the idea of normalized data.
Redux Normalizr: Improve your State Management
A tutorial describing how to use Normalizr for improved data management of nested data in Redux
Using normalizr.js in a Redux store
Some examples of using Normalizr and selectors to manage normalized data
Two mistakes I made working with Redux
Some suggestions on how to handle denormalizing data and defining actions.
"How do you add/remove to a redux store generated with normalizr?
Stack Overflow discussion of how to handle updates to normalized data
GraphQL is not only for Backend
A look at how to use GraphQL to query into a Redux store
Dissecting Twitter's Redux Store
An informative look at the contents of the Redux store for Twitter's new mobile site. The second article shows how to dig through the minified JS to enable use of the Redux DevTools against a production site.
"Why are you supposed to normalize data in Redux?"
A Twitter thread with some excellent discussion, explaining why use of normalized data is encouraged with Redux.
Redux Clerk: Reusable action creators and reducers for async CRUD
Discussion of a library that tries to reduce the repetitive nature of async CRUD work in Redux
json-api-normalizer: An Easy Way To Integrate the JSON API and Redux
An in-depth article discussing why normalization of data is a good practice with Redux, and how use of the JSON API format can make normalized data easier to work with.
How I Stumbled Upon Normalizing Redux State
A short summary of the benefits and concept behind normalizing state
The only reducer you will ever need
Demonstrates using Normalizr and seamless-immutable to write a generic entity merging reducer
How to use Normalizr to organize data in a Redux store
A 2-part post with examples of normalizing nested data using Normalizr, using Redux-Saga to control the fetching logic, and denormalizing the data for use in the UI.
Describes an NgRX-based library for generating reducer operations and selectors for normalized entities.
Shape your Redux store like your database
Discusses the merits of storing data in arrays vs lookup tables for access speed, and adding additional indices to allow easily lookup up items based on other values besides IDs.
Redux Patterns: Rethinking
Thoughts on dropping the common list of "all IDs" in a normalized state structure, and just iterating over all items using
Object.keys()to grab the IDs.