React · Junior · Question 31 of 75

How do you set an inline style in JSX?

Explanation

style takes an object with camelCase properties. The outer braces embed an expression, the inner ones are an object literal. For most properties, numeric values are interpreted as pixels (fontSize: 14 → 14px).

Further reading

Problem with a question

React · Junior · question 31

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