class vs className in React 16

后端 未结 8 2403
感动是毒
感动是毒 2020-11-29 02:56

I saw that React 16 allows for attributes to be passed through to the DOM. So, that means \'class\' can be used instead of className, right?

I\'m just wondering if

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 03:41

    In ReactJS, we are dealing with JSX and not HTML as you all know. The JSX wants you to use className because it is an underlying javascript DOM API! class being a reserved keyword in JS is not the primary reason why we are not using class and instead, using className. It is because we are referring to that DOM API

提交回复
热议问题