From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

What are React hooks and state in React?

What are React hooks and state in React?

So we've looked at properties, we've looked at component trees, we've looked at destructuring, and we've looked at iterating. These are all very valuable topics with React. The next thing that we should really dive into together is adding interactivity with state. So React helps us add interactivity with state with event handlers. How does that work? How does that work? Well, let's think about what we're even talking about. Interactivity with state. So far, our application here is just a blog app. Users can't do anything. What if they wanted to actually like one of these posts? What if they were like, hey, I like this post. By the way, we should remove one of these John Wicks. We can't have too many John Wicks. I see I did. I just need to save and refresh and that error is gone. So if we want to add a button, we don't have to make it its own component for now. We can just add a button HTML tag in our homepage. So under our list, we can have a button that can like stuff. And we'll…

Contents