in React JS by
Q:
Why React uses className over class attribute?

1 Answer

0 votes
by

class is a keyword in JavaScript, and JSX is an extension of JavaScript. That's the principal reason why React uses className instead of class. Pass a string as the className prop.

render() {

  return <span className={'menu navigation-menu'}>{'Menu'}</span>

}

Related questions

0 votes
asked Feb 24, 2021 in React JS by SakshiSharma
0 votes
asked Jan 31, 2021 in React JS by Robindeniel
0 votes
asked Jul 2, 2019 in React JS by Venkatshastri
+1 vote
asked Feb 6 in Vue.JS by john ganales
...