Why React uses className over class attribute?

  • To avoid naming conflicts with JavaScript class keyword
  • To follow HTML5 standard
  • To improve performance
  • To make the markup more concise
React uses className instead of class attribute to avoid naming conflicts with the JavaScript class keyword. Using className also makes it easier to use CSS modules and other tools that work with class names.
Add your answer
Loading...

Leave a comment

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