Elliot Yang 的动态

动态详情

返回列表
Elliot Yang

Elliot Yang

React v16 support custom DOM attributes.
In the past, React used to ignore unknown DOM attributes. If you wrote JSX with an attribute that React doesn't recognize, React would just skip it.
For example, let's take a look at the below attribute:

js
1<div mycustomattribute={'something'} />

Would render an empty div to the DOM with React v15:

html
1<div />

In React v16 any unknown attributes will end up in the DOM:

html
1<div mycustomattribute='something' />
浏览:195点赞:0