Having to use useState
for every item in your state quickly gets cumbersome. In this lesson, we’ll learn how to refactor our component to use useReducer
instead.
We'll cover:
useReducer
reducer
function that makes changes to the state based on incoming dispatchesWhy do you use a ref to store the intervalId?
Whoops, comment belongs to previous video in list.
Looks like the code is no longer at sandbox...
Looks like the code is no longer at sandbox...
I got this fixed. The github changed from master
branch to main
branch and that messed up the codesandbox.