August 2017
Beginner
374 pages
10h 41m
English
After combining our reducers, we can test them out by calling the appReducer:
let state = appReducer(undefined, { type: 'INIT_ACTION' })console.log('initial state:', state)
The resulting initial state looks as follows:
{ "posts": [], "filter": "all"}
state = appReducer(state, createPost('dan', 'test'))console.log('state after createPost:', state)
The state now looks like this:
{ "posts": [ { "user": "dan", "text": "test" } ], "filter": "all"}
Read now
Unlock full access