Are custom DOM attributes supported in React v16? in REACT

Practice



Yes. In the past, React ignored unknown DOM attributes. If you wrote JSX with an attribute that React did not recognise, React would simply skip it. For example, this:

<div mycustomattribute={'something'} />

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

< div />

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

<div mycustomattribute='something' />
 

This is useful for supplying non-standard, browser-specific attributes, for trying out new DOM APIs and for integrating with third-party libraries.

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone