Current section: Advanced State Management 36 exercises
Problem

New State

Loading exercise

Transcript

00:00 For the first part of this exercise, our counter is already implemented using useState, and your job is to rewrite it using useReducer. So this is absolutely a thing that you can do, and I have a blog post, how to implement useState with useReducer, and another one, should I useState or useReducer?

00:18 You can take a look at these blog posts later or now if you'd like to pause the video. But the idea here is that there is some overlap in what these APIs are capable of, and you can even build one out of the other. And useReducer is certainly a very powerful API,

00:36 and we're going to be getting an idea of the overlap by migrating from one to the other, but in such a way that it maintains the API of state updates that we experience with useState. So it's gonna be fun, and it should be pretty quick. We'll see you when you're done.