← BYTES
React.js·Starter·Ref: 4.1.3

What does calling useState return?

Have a question about this video? Mention reference 4.1.3 when you contact us.

a.A single value representing the current state
b.A function that updates the DOM directly
c.A promise that resolves to the state value
d.An array with exactly two elements: the current state value and a function to update it
`useState` returns a two-element array `[value, setValue]`, conventionally destructured with array destructuring. The first element is the current state value for this render; the second is the setter function used to request an update.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES413#Reactjs