I have a react-intl package issue. I am using an injectIntl way to use props in the component. Pure String is fine, but it will not work if I wrapped the HTML tag.
Pure String Success Case
const _tableNoText = intl.formatMessage(
{ id: 'footer.table_no' },
{ value: basket.table }
);
//console -> Table 1
Pure String with HTML Tag Fail Case
const _tableNoText = intl.formatMessage(
{ id: 'footer.table_no' },
{ value: <b>basket.table</b> }
);
// console -> Table [object object]
If I change the formatMessage
to formatHTMLMessage
, it will output the same above result, how should I fix that?
Thanks all very much.