The course is part of this learning path
This module looks at how to manage state in React. You’ll be looking at state management, context, and reducers.
The objectives of this module are to provide you with an understanding of:
- State Management
- How to create and provide context
- How to provide dispatch
This learning path is aimed at all who wish to learn how to use the ReactJS framework.
We welcome all feedback and suggestions - please contact us at firstname.lastname@example.org to let us know what you think.
If we have a Reducer, we need at least one Action, perhaps several. Action is usually an argument supplied to a reducer function as an object. But surprisingly, its job is to help the Reducer in deciding which execution path to follow, to create the new state. An Action object, usually has at least two properties. The type, this is generally a string of the Action is identified by and, the payload, this is the data that has been dispatched as part of the call to update the state. If we're thinking about a reducer for the filter courses table up, one of the Actions we need, is to get all of the courses. Another Action, could be to add a course when the user submits the form sending data to the server. Because there's so about course is context. We're going to put the Reducer and any other code we might need in the courses context file we created earlier. If you look on line 15, there's no any courses Reducer function. It's not complete, because we haven't identified, what we will need to do to return the new state for the Actions. But it's a start. We haven't mentioned, the use Reducer hook in React yet.