React · Junior · Question 55 of 75

Why does <img src={url}> without a closing slash fail in JSX?

Explanation

JSX is stricter than HTML: <br />, <input /> and any component without children need the closing slash.

Further reading

Problem with a question

React · Junior · question 55

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