JavaScript Archives - Software Engineering Daily cover image

Learning React with Kent C. Dodds

JavaScript Archives - Software Engineering Daily

CHAPTER

Using State Hook in a React Component

Hook is basically a special function from react that allows you to hook into either state or side effects, or some combination of the two. You have use state Hook and by convention, they're all prefixed with us so that we can some static cod analysis tools that can give us warnings when we're doing things incorrectly. So if we were building a very simple counter, then you could say, react dot use state. And then you also have a reactot use effect, which you pass a call back to. Every time there's a re render, so every time your component up date some state, then this call back will get called. There's a way for passing values all throughout

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner