While working on a React project, you notice that the CSS styles aren't being applied because the developer used the HTML attribute names in JSX. Which attribute is most likely the cause?

  • class
  • class-name
  • className
  • css-class
In JSX, to apply CSS classes, you should use the attribute className instead of class. Using class will not apply the styles correctly, as it conflicts with JavaScript's class keyword. The correct attribute to use for applying CSS classes in React components is className.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *