React · Junior · Question 54 of 75

Which attribute links a <label> to an input in JSX?

Explanation

Like className, htmlFor avoids a reserved JavaScript word. Wrapping the input inside <label> also links them without an id.

Further reading

Problem with a question

React · Junior · question 54

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