You need to create a useReducer inside the component , you need to pass reducer and initial state to it. This will act as reducer for that component as we defining and declaring inside it. It acts as a store only for that component.
This will reduce the multiple declarations of useState.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey, could you explain it? How useReducer() can replace states?
You need to create a useReducer inside the component , you need to pass reducer and initial state to it. This will act as reducer for that component as we defining and declaring inside it. It acts as a store only for that component.
This will reduce the multiple declarations of useState.