FAQ: Style - Inline Styles

This community-built FAQ covers the “Inline Styles” exercise from the lesson "Style ".

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part II

FAQs on the exercise Inline Styles

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Doble Curly Braces What are those for?

The outer curly braces inject JavaScript into JSX. They say, “everything between us should be read as JavaScript, not JSX.”

I believe in a different way. Yes, outer curly brace is to inject Javascript in JSX, but the inner curly brace is because we are injecting a CSS object (wrote in JS way: camelCase).

  • This is part of the recommended practices of ECMA4 maintained up today.
  • Write in camelCase because ECMA based languages don´t allow hyphenated named declarations then read - (hyphen symbol) as an operator and results in an Error

Since this approach, the Double Curly Braces isn’t complex, you only need to understand their background.

So inline styles are not considered bad practice and are actually used?
What is the best practice for dealing with styles in React?