Course lesson

Simplify a Component Reducer with the React setState Hook

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

Duration
2 min
Access
Free
Transcript
Available

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