Skip to content

String variables in templates are always escaped #1189

Closed Answered by Haroenv
Mikilll94 asked this question in Q&A
Discussion options

You must be logged in to vote

you need to use dangerouslySetInnerHTML to render raw html

            return html`<div class="aa-ItemWrapper">
              <div class="aa-ItemContent">
                <div class="aa-ItemContentBody">
                  <div
                    class="aa-ItemContentDescription"
                    dangerouslySetInnerHTML="${{ __html: item.title }}
                  ></div>
                </div>
              </div>
            </div>`;

https://codesandbox.io/s/dank-violet-j4mgws?file=/app.tsx:584-967

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Mikilll94
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants