If you want to display a string like °F in a React view as °F, I've found the documented way to do this as something like:
import React from 'react';
export default function renderSafeHTML(rawHTML, element = 'div') {
return React.createElement(element, {
dangerouslySetInnerHTML: {
__html: rawHTML
}
});
}
And use as something like:
{renderSafeHTML('°F')}
Is there any sort of helper in the ecosystem for simplifying escaped content? Ember has {{content}} for escaping and {{{content}}} for displaying content w/o escaping and .safeString for marking strings as safe.
Is there something like that in React? I'd be curious about trying to add this functionality to JSX as {} and {{}}, similar to Ember. Why doesn't this exist in React?