Skip to content

feat: support dangerouslySetInnerHTML on Fragments#453

Merged
marvinhagemeister merged 5 commits intomainfrom
fragment-html
Mar 21, 2026
Merged

feat: support dangerouslySetInnerHTML on Fragments#453
marvinhagemeister merged 5 commits intomainfrom
fragment-html

Conversation

@marvinhagemeister
Copy link
Copy Markdown
Member

@marvinhagemeister marvinhagemeister commented Mar 21, 2026

This PR adds support for using dangerouslySetInnerHTML on Fragments. It allows you to inject unsafe raw HTML without needing a wrapping element which is often undesired when working with CSS grid or flexbox. I've opted to insert surrounding comments here as well, so that we could in theory hydrate it and support the same feature client-side.

Before:

<article>
  <h1>{post.title}</h1>
  <div dangerouslySetInnerHTML={{__html: post.content }} />
</article>

After:

<article>
  <h1>{post.title}</h1>
  <Fragment dangerouslySetInnerHTML={{__html: post.content }} />
</article>

This superseeds: #418

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 21, 2026

🦋 Changeset detected

Latest commit: 5a5e83f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-render-to-string Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@marvinhagemeister marvinhagemeister merged commit d21cdd9 into main Mar 21, 2026
1 check passed
@marvinhagemeister marvinhagemeister deleted the fragment-html branch March 21, 2026 09:00
@github-actions github-actions bot mentioned this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants