class vs className in React 16

后端 未结 8 2412
感动是毒
感动是毒 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:59

    There is no real explanation by React team on this but one would presume it to be differentiated from reserved keyword "class" in Javascript since its introduction in ES2015+.

    Even if you use "class" in element configuration while creating element, it won't throw any compilation/rendering error.

提交回复
热议问题