Transcript
00:00 Now our users want to be able to go back in time so they go Oh, you know what? I didn't want to go there. I wanted to go here instead, right? Probably not the fairest thing to do in a game, but maybe you're playing with your kid and you're trying to go easy on them I don't actually do that with my kids I say hey
00:16 I'm gonna go like normal difficulty on you and when you beat me you're gonna feel so much Better than if I'd gone easy on you the whole time, right? But anyway, I'm not like mean about it or anything We have a good time and my son is like way better than I am at a lot of games now
00:33 But yeah, so let's just assume we want to be able to go back in history for this particular game So that's what we're trying to do Now this is going to require a number of refactorings and some of those have been done for us already Some of the UI has been moved around and stuff Feel free to do that yourself
00:50 If you'd like to just like go back to the previous solution and then work your way Toward this UI if if that's what you want to practice but yeah We're going to be rendering these this list of elements of these buttons and we're also going to be storing our state a little bit Differently, so you'll notice that our local storage is now different
01:11 So here's our squares from the previous step and now we have a new tic-tac-toe that includes a history Object and that has a current step or it's an object that has a history property and that is all of the Phases that we were in so at this step we were at here's what the squares looked like and then at this step
01:31 Here's the squares and so on and then we also have a current step So we know which one of these steps are we're currently looking at and then we render everything based off of that So we have a couple of changes to make in our game feature But I think it'll be interesting for you to explore this to dive a little bit deeper into managing state deriving state
01:52 having multiple elements of state like this and All of that so might be a good idea to clear your local storage before you get started into this But in any case we're going to be handling errors and stuff like that. Anyway, so I Think we're ready to go. So let's have a good time