Current section: State Reducer 30 exercises
Problem

State Reducer

Transcript

00:00 Our toggle has a new feature. Check this out. Every time I click it, we're going to keep track of how many times it's been clicked. How neat is that? But then, once you click it four times, it should say, well, you clicked too much, and it shouldn't allow you to click any more until you reset. And then you'll be able to click some more until you reset again. So right now, the functionality doesn't work, though.

00:19 I can click as many times as I want. So your job is to make it so that that works by implementing a custom reducer. You're going to have to do a little bit of copy-paste that we'll fix in the next step. So don't worry yourself too much about that. But go ahead and give this a whirl. Add your own reducer so that you can handle clicking too much.

00:38 You just want to return the original state. If they click too much, it's a spoiler alert. But have a good time with this, and we'll see you when you're done.