Transcript
00:00 So now, we're finally going to make this work. So what we need to do, or what the problem is, is that even though we are triggering a re-render of the counter every time, each time it's calling useState with this initial value, and so that initial state gets passed in here,
00:17 and we're resetting this state to that initial state. It's actually not entirely accurate to say that we're resetting this because we're actually just creating a new state variable. The first time we run it, we get our state variable, we get our setState variable, we pass those back to our counter, and then it re-renders,
00:37 we're calling useState again, and now we're actually creating a new state variable and setState variable. So we're not actually preserving that state between renders, we're creating brand new instances of this. So we need to have just one instance for this component and reference that every time. So we don't want to reset to
00:56 the initial state every single time it's called, we just want to initialize it. So once it's been initialized, then we should be able to reference the previously initialized value. So that's what we're doing in this step, and this should make things actually work. Get to it.