How to set inline styles with React?

Sometimes, we want to set inline styles with React.

In this article, we’ll look at how to set inline styles with React.

How to set inline styles with React?

To set inline styles with React, we set the style prop of an element.

For instance, we write

<span
  style={{ fontSize: 1.7 + "em" }}
  className="glyphicon glyphicon-remove-sign"
></span>

to set the fontSize property to set the font-size CSS property inline.

Conclusion

To set inline styles with React, we set the style prop of an element.