June 2021
Intermediate to advanced
398 pages
9h 35m
English
Global data have different problems than local data. In particular, we need to make sure that changes to the global data store happen consistently for all users so that different parts of the application all have access to data in the same state.
We’re going to solve our global data problem by refactoring our data using a JavaScript pattern called a reducer and a related structure called a store.
A reducer is a JavaScript function that takes two arguments. The first argument is an object representing a state. The second argument represents an action to take. The return value is a new state object representing the state of the data after the action is performed. The action is meant to describe the state change in terms of application ...