If you need to work with strings that for some reason contain these \u.... codes \u.... instead of real letters, convert them to numbers and then use String.fromCharCode () to turn these numbers into real letters, We can use regular expression replace with handler function for this:
function convertUnicode(input) { return input.replace(/\\u(\w\w\w\w)/g,function(a,b) { var charcode = parseInt(b,16); return String.fromCharCode(charcode); }); } var Hello = React.createClass({ getInitialState: function() { return { name: convertUnicode(this.props.name) }; }, render: function() { return <div>Hello {this.state.name}</div>; } }); React.render( <Hello name="Informaci\u00f3n" />, document.getElementById('container') );
Violin: https://jsfiddle.net/dddf7o70/4/
source share