I have a html string that contains a link. I need to add the attribute rel="noopener" for security purposes. The html string is injected through dangerouslySetInnerHtml:
const Component = ({ message }) => {
return (
<div>
<div dangerouslySetInnerHTML={{ __html: message }} />
<div>
);
};
The string looks like: Hello check out <a href="https://my-link.com" target="_blank">this page</a>
So the desired output would be: Hello check out <a href="https://my-link.com" target="_blank" rel="noopener">this page</a>
How to do it?