import { createElement as h } from 'react'; /** * Astro passes `children` as a string of HTML, so we need * a wrapper `div` to render that content as VNodes. * * As a bonus, we can signal to React that this subtree is * entirely static and will never change via `shouldComponentUpdate`. */ const StaticHtml = ({ value, name, hydrate = true }) => { if (!value) return null; const tagName = hydrate ? 'astro-slot' : 'astro-static-slot'; return h(tagName, { name, suppressHydrationWarning: true, dangerouslySetInnerHTML: { __html: value }, }); }; /** * This tells React to opt-out of re-rendering this subtree, * In addition to being a performance optimization, * this also allows other frameworks to attach to `children`. * * See https://preactjs.com/guide/v8/external-dom-mutations */ StaticHtml.shouldComponentUpdate = () => false; export default StaticHtml; on value='2.0'>2.0 Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/benchmark/packages/adapter/README.md (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2024-11-06Update to Vite 6.0.0-beta.6 (#12323)Gravatar Bjorn Lu 15-100/+123
2024-11-06[ci] formatGravatar Bjorn Lu 2-18/+17
2024-11-06Add support for Svelte 5 @render syntax (#12390)Gravatar Bjorn Lu 3-0/+30
2024-11-06fix(deps): update all non-major dependencies (#12366)Gravatar renovate[bot] 29-533/+552