Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Save Previous States with a History State

    reactReact
    >=16.9.0

    In order to make sure the user actually picked the answer they wanted, we’ll add a confirmation state to the state machine that gives them the option to submit their answer or go back and change it. When they go back, we need the state machine to remember all the substates that were active in the previous state. We’ll accomplish this using a history state.