0 votes
in ReactJS by
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 Apr 14, 2021 in ReactJS by SakshiSharma
0 votes
asked Jan 31, 2021 in ReactJS by Robindeniel
...