const msgid =
'Not all item(s) could be added to your <a title="Cart" href="http://localhost:4502/homepage.html" target="_blank">Cart</a>. Please review error(s) below. ';
const msg =
'Not all item(s) could be added to your <a title="Cart" href="http://localhost:4502/homepage.html" target="_blank">Cart</a>. Please review error(s) below. ';
<FormattedMessage id={msgid} defaultMessage={msgid}>
{data => <span dangerouslySetInnerHTML={{ __html: data }} ></span>}
</FormattedMessage>
Version: "react-intl": "^5.20.13",
Only text is displayed without the link. Why?
The
idsupposed to be a string of a key instead of a variable. Therefore, to fix your issue, you need to simply update your code with the followingSee your code in action here: https://codesandbox.io/s/sharp-frost-76fsxl?file=/src/App.tsx
Read more about
FormattedMessagecomponent: https://formatjs.io/docs/react-intl/components/#formattedmessage