4

I get SVG or dynamic HTML from a headless CMS. But I can't render it in Qwik.

In Next.js we would use the dangerouslySetInnerHTML for this purpose.

What is our option in Qwik? I can't find anything in their documentation.

1 Answers1

4
import { component$ } from "@builder.io/qwik";

export default component$(() => (
  <div
    dangerouslySetInnerHTML={`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
  <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
</svg>
`}
  ></div>
));
Harsh Mangalam
  • 1,116
  • 1
  • 10
  • 19