Implementing an action creator for clearing the posted question

Our final action creator is for clearing the posted question result. Let's implement this in one step:

export const clearPostedQuestionActionCreator: ActionCreator<
PostedQuestionAction
> = () => {
const postedQuestionAction: PostedQuestionAction = {
type: 'PostedQuestion',
result: undefined,
};
return postedQuestionAction;
};

This action creator is much simpler because it is synchronous we simply return a PostedQuestion action with an undefined result property.

So, action creators are straightforward to implement but the type annotations are a little tricky, particularly when they are asynchronous.

Our Redux store is shaping up nicely now. Let's move on and create a reducer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.247.58