Simplify a Component Reducer with the React setState Hook

Share this video with your friends

Send Tweet

Having a reducer is great for complex components but for our simple Stopwatch it’s a layer of abstraction that might not be necessary.

We'll cover:

  • Converting your reducer into a function that shallow merges the new state into the old
  • Refactoring your dispatch function into setState
Gautham Stalin
Gautham Stalin
~ 6 years ago

Didn't see the setState coming. Great tutorial!!

Srinivas  Kasiriveni
Srinivas Kasiriveni
~ 6 years ago

Great tutorial!!

Ajay Kumar
Ajay Kumar
~ 5 years ago

Magic of logical thinking !.

Terry DI LUZIO
Terry DI LUZIO
~ 5 years ago

Very elegant, great one Kent