From the course: Building React and ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Redux store

Redux store

From the course: Building React and ASP.NET Core Applications

Start my 1-month free trial

Redux store

- [Instructor] The React reducers specify how the application's state changes. Now, it's important to know that the actions that we created on the last part can describe only what happens. But they don't describe how the application's state changes. So, let us go to Visual Code and create our reducer. In here I will go to the Explorer, and then inside src folder, I'll create a new folder for reducers. So I'll just name it reducers. Then inside this folder, let us create a new file named tripReducers.js. The first thing that we need to do at the top is that we need to import all the actions. So I'll just write in here import, and then I'll import the GET_ALL_TRIPS_REQUEST. So, that's going to be from, you write dot dot to go a step back, then actions/tripActions. So get the GET_ALL_TRIPS, then we'll get the GET_ALL_TRIPS_SUCCESS and the GET_ALL_TRIPS_ERROR. Now, let us define the initial state of our app. So for…

Contents