October 2019
Intermediate to advanced
426 pages
11h 49m
English
We start by defining the context in our src/contexts.js file.
In src/contexts.js, we define the StateContext, which is going to store the state value and the dispatch function:
export const StateContext = React.createContext({ state: {}, dispatch: () => {}})
We initialized the state value as an empty object, and the dispatch function as an empty function, which will be used when no provider is defined.
Read now
Unlock full access