DEV Community

Discussion on: How to use React Hooks to create a Counter Component

Collapse
 
dayoolacodes profile image
Dayo Ayoola

setState in the react useState hooks can also take a callback function which has the previous value of that particular state. so you can update the previous value to whatever you want.