loading...

Discussion on: # State Hook in React

Collapse
codingcardio profile image
codingcardio

Great intro! Just want to add that the setX in useState also takes a callback function to ensure you're using the latest state value. So for likes, you could do setLikes((x) => x + 1)