Closed jake-danton closed 8 months ago
dangerouslySetInnerHTML
is what you want:
const MAP = {
imports: {
"preact-iso": "https://esm.sh/preact-iso@2.4.0"
}
};
const doc = html`
<html>
<head>
<script type="importmap" dangerouslySetInnerHTML=${{ __html: JSON.stringify(MAP) }}></script>
</head>
</html>
`;
Thank you @rschristian !
I am trying to figure out how to get this valid html working with
htm
:As is, it renders as:
Which is invalid HTML. And single quotes won't work here as it keeps them single quotes in the output and the result is invalid JSON.
Is there a way to correctly handle this? Something like unsafeHtml in
lit
that would let me concatenate the JSON object as a string directly parsed as a VNode?