Transcript
00:00 So, there is a hidden issue with the state initializer pattern that you very easily could ignore, but it's also very easy to resolve. And it's also not very common to experience. And so, I want to show it to you so that you just do this by default and you never have
00:18 the problem, because at scale, everything, even edge cases, will happen a lot. And so, here, Kelly, the coworker, put together this initial on state variable, and so now when we click this button, we're going to change what initial on is.
00:36 And so here, if I turn this off and then reset, it's going to reset back to on. If I click this again and then change initial on to false and I reset, it's not going to reset to on. Now, you might argue with me about whether this is a desirable feature or not, but when
00:54 I see the word initial, I think, like, this is the initial value. And resetting to a different value other than the initial one doesn't make any sense. And so, what I want you to do is make it so that I can click on or toggle initial on,
01:12 turn this off, and then reset, and it should turn back on, because the original initial on value was true. So that's your objective for this one. We'll see you when you're done.