October 2019
Intermediate to advanced
426 pages
11h 49m
English
We have already handled the loading state in the ChangeTheme component. Now, we are going to implement the error state for posts.
Let's get started handling the error state for posts:
function errorReducer (state, action) { switch (action.type) { case 'POSTS_ERROR': return 'Failed to fetch posts' default: return state }}
export default function appReducer (state, action) { return { user: userReducer(state.user, action), posts: postsReducer(state.posts, action), error: errorReducer(state.error, action) }}
Read now
Unlock full access