Transcript
00:00 So this exercise is just to get you a little bit more experience playing around with state and managing state. So we're going to be building tic-tac-toe. It's going to be fun. One thing that we're going to be doing in this exercise that we haven't done so much in previous ones is I kind of mentioned this in passing a couple of times,
00:18 but our state updater that we get back from useState can, in fact, be passed at a function which returns the new state. And that function will be called with the current stater or what the previous state will be when we're done. And so that allows us to encapsulate
00:37 some of our logic a little bit better and also helps us to avoid some stale references to old versions of state, like if you're doing something asynchronous. So yeah, there are a number of benefits to using the function version over just
00:53 passing the actual value you want to have set. And so we are going to be utilizing that in this set of exercise steps for building out tic-tac-toe. But it's going to be fun. You're going to be doing some state stuff, but you're also going to be doing some useEffect stuff.
01:11 It's, yeah, I think that you're going to have a good time with this. We're even going to be working with local storage and have a game history feature. It's going to be a lot of fun. So let's get into it.