From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Setting up reducer for counter

Setting up reducer for counter

Welcome back, let's continue and set up our reducer. For setting up our reducers, we first have to define the actual interface and an actual variable value which is actually going to hold this. So reducer is basically the core functionality and the core file which actually holds down all the logic for you. Other than that, setting up all the Redux-based files are pretty easy and just basic programming. So, the actual logic and the actual core of holding the values actually comes to this place. This is going to be the file where you set up the business logic. For example, in this counter example, what happens when we actually increment this state or we perform a decrement operation on that state. So this is going to be the file which actually defines what is the logic running behind the scene. This is also the place where you can call the APIs and fetch data from your backend and send it along to your front end and then front end is only responsible for showing the data nicely on the…

Contents