javascript - React keeps escaping the amp character (&) in attributes -


i have component data-icon attribute. value of attribute should be, instance, &#xf00f css can render via content: attr( data-icon );.

however, whatever try: react keeps escaping &. when provide proper unicode character \u0026#xf00f.

is there way stop react messing value? besides dangerously setting inner html, not want add wrapper.

component

define( [ 'react', 'util' ], function( react, util ) {     return react.createclass(     {         render: function()         {             //var amp = '\u0026',             var amp = string.fromcharcode( 38 ),                 // util.icons[x] returns string, such "f00f"             code = amp + '#x' + util.icons[this.props.name] + ';';              return (                 <i data-icon={code}>                     {this.props.children ? <span>{this.props.children}</span> : null}                 </i>             );         }     } ); } ); 

usage

<widget.icon name="add" /> 

output

<i data-icon="&amp;#xf0fb;" data-reactid=".170lse36465.7.0"></i> 

well, realized, particular use case can away with:

<i data-icon={string.fromcharcode( "f00f" )} /> 

https://github.com/facebook/react/issues/3769