October 2019
Intermediate to advanced
426 pages
11h 49m
English
Next, we are going to define the reducer function in a similar way that we did for the user state:
function postsReducer (state, action) { switch (action.type) {
case 'CREATE_POST': const newPost = { title: action.title, content: action.content, author: action.author } return [ newPost, ...state ]
Read now
Unlock full access