Tyler Hawkins
1 min readAug 10, 2020

--

Hey Stephan, yes that is correct that you can pass either a function or a value as an argument. This is the important part highlighting the difference:

"The key here is that if your new state relies on the value of the old state, you should always use a function as the argument. If you are setting a value that does not rely on the value of the old state, then you can use a value as the argument."

--

--

Tyler Hawkins
Tyler Hawkins

Written by Tyler Hawkins

Staff software engineer. Continuous learner. Educator. http://tylerhawkins.info

No responses yet