If you have to work with strings that have, for whatever reason, literally the letters \u
followed by hexadecimals in them instead of being real letters, convert them to numbers, and then use String.fromCharCode() to turn those numbers into real letters. We can use a regexp replace with handler function for this:
// put this in whatever utility library file you have:
export function convertUnicode(input) {
return input.replace(/\\+u([0-9a-fA-F]{4})/g, (a,b) =>
String.fromCharCode(parseInt(b, 16)));
}
And then in your component:
import { convertUnicode } from "...your util lib...";
function Hello(props) {
const name = convertUnicode(props.name);
return <div>Hello {name}</div>;
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Hello name="Informaci\\u00f3n"/>);
Fiddle: https://jsfiddle.net/shdye3pq/
\u....
markers...