I have a REACTSjs application and am trying to solve a problem with localization.
I receive some text from the API in which there are some special characters marking the text that should be localized. Something like this:
This is a translated text: [labels.example]. Awesome!
I am using react-redux-localize to translate the keys so the result should look like this:
This is a translated text: . Awesome!
I tried solving this problem with renderHTML from react-render-html:
function localizeNames(text) {
text = text.replace("[", "");
return text;
}
and calling this function in my render function:
{renderHTML(localizeNames(text))}
but it throws an exception:
Warning: The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
Can anybody help me with this use-case? I am quite new to javascript.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)