August 2017
Beginner
374 pages
10h 41m
English
Creating posts will work very similar to creating a user. We will replace our synchronous createPost action creator with an asynchronous action creator that sends a request to the API. Instead of returning the action object, we will use the thunkCreator utility function we created earlier:
export const CREATE_POST = 'CREATE_POST'
Replace it with these three action types:
export const CREATE_POST_REQUEST = 'CREATE_POST_REQUEST'export const CREATE_POST_SUCCESS = 'CREATE_POST_SUCCESS'export const CREATE_POST_FAILURE = 'CREATE_POST_FAILURE'
Read now
Unlock full access