TL; DR
I think you are stuck with the help dangerouslylSetInnerHTML
.
Explanation
React only supports a subset of HTML / SVG elements and is <use />
not supported.
As of v0.12, React switches to restricting lowercase tag names to HTML / SVG elements only , but since you are running into this not for elements, it is whitelisted. FB recommends opening the issue for valid tags that they don't yet support.
You can use {React.createElement('use')}
to force React to display the tag <use />
, but it still won't let you set the attribute xlink:href
, since React doesn't support unknown DOM properties (see the open issue on the topic ). In a previous release, some suggested using this.getDOMNode().setAttribute
in componentDidMount
to set any custom attributes, but depending on your use case, this might be even more awkward than the option dangerouslySetInnerHTML
.
source
to share