DEV Community

Discussion on: 3 Reasons to useReducer() over useState()

Collapse
 
geisonmcd profile image
Geison • Edited

I have a screen where I show a list of (school) exams. When I click in one it navigates to another page where I can edit each exam field.

In this page I created a state for each single exam field (name, code, max weight, start date, end date, etc). Is this a case where I should've used a reducer? I also could create a state with the whole exam object right?

It's not clear to me the reducer advantage in my example.

Collapse
 
affkar profile image
Karthick

the component for the second page or the second component should just accept the exam as a prop.