You’ve made it to the final exercise! 🎉 We’ll learn how to distribute state in localized, private little entities called actors.
spawn() actors dynamically and see how this can be helpful in isolating logic and statetimerAppMachine.js, spawn a new timer machine via createTimerMachine() on the ADD action.context via assign() so that it has the updated context.timers (with the newly spawned timer appended) and context.currentTimer (with the index of that timer).Overall, a sample user flow should look like this:
<NewTimer> screen<Timer> screen shows with the user’s specified duration<NewTimer> screen.<NewTimer> screen to add a new timer.