This is regarding non-standard attributes. https://facebook.github.io/react/docs/tags-and-attributes.html
In react I have done this:
React.createElement('div', {image:'blah', etc:'blah'});
I need image and etc to be set on the element with setAttribute, and I need react to use its smarts to maintain it as it changes.
A solution here https://stackoverflow.com/a/21654914/1828637 says to add it on componentDidMount but this is not a solution. The attribute will not be maintained as it changes by the react framework.
Is there anyway to tell react to set the attribute on my custom tags?
In react 16 custom attributes are now possible
// Your code:
<div mycustomattribute="something" />
// React 15 output:
<div />
// React 16 output:
<div mycustomattribute="something" />
react 16 custom attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With