React · Junior · Question 11 of 75

What does useState(0) return?

Explanation

const [count, setCount] = useState(0) - array destructuring lets you name the variables however you like. The initial value is used only on the first render. If computing it is expensive, pass a function: useState(() => compute()).

Further reading

Problem with a question

React · Junior · question 11

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz