React 中的 formatHTMLMesssage() 函数不呈现特殊字符

formatHTMLMesssage() function in React not rendering special characters

下面是我的代码:

<RaisedButton id="abc" title={formatHTMLMessage({id: 'T_TEXT_TOOL_TITLE'})} className="abcClass" />

T_TEXT_TOOL_TITLE=Some Text to show&#039;

在 UI 中呈现上述组件时,formatHTMLMessage 函数不会将 &#039; 字符呈现为单引号 ('),而是显示&#039;.

我也尝试了另一个功能formatMessage(),但是没有用。 请找到屏幕截图:

请尝试以下代码。希望它能解决这个问题。

const parser = new DOMParser();
T_TEXT_TOOL_TITLE=Some Text to show&#039;

<RaisedButton id="abc" title={parser.parseFromString(formatHTMLMessage({id: 'T_TEXT_TOOL_TITLE'}), 'text/html').body.textContent} className="abcClass"/>