Become a member
to unlock all features

Create egghead account to access 1,000+ tutorials and resources from expert developers.

Create account

    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.

    We'll cover:

    • Converting your reducer into a function that shallow merges the new state into the old
    • Refactoring your dispatch function into setState