You Don’t Know useState Until You’ve Used Functional Updates

When we might need useState functional updates and how to use them

Tomasz Fiechowski
Better Programming
Published in
5 min readJan 13, 2021

--

Half-painted wall
Finding the right tool is often half the battle. Photo by the author.

When we need to hold any state, useState is the most common solution in React nowadays. It returns the current state value and a method to update it:

const [state, setState] = useState(initialValue);

--

--