mirror of
https://github.com/withastro/astro.git
synced 2025-09-28 00:24:24 +08:00

* First pass at supporting React 18 in @astrojs/react * Try marking React 18’s `react-dom/client` as external * Try a different approach to importing different React versions * Allow resolving JSON modules * Revert "Allow resolving JSON modules" This reverts commit 5279b7249c52b20fd74fe48f9f1047c9b3a117dc. * Try the separate client entrypoint approach from #2946 * Clean up diff * Trying to see something * Just keep swimming… 🐠 * update to support react 18 * add changeset * add docs Co-authored-by: delucis <swithinbank@gmail.com>
14 lines
416 B
JavaScript
14 lines
416 B
JavaScript
import { createElement } from 'react';
|
|
import { hydrateRoot } from 'react-dom/client';
|
|
import StaticHtml from './static-html.js';
|
|
|
|
export default (element) => (Component, props, children) =>
|
|
hydrateRoot(
|
|
element,
|
|
createElement(
|
|
Component,
|
|
{ ...props, suppressHydrationWarning: true },
|
|
children != null ? createElement(StaticHtml, { value: children, suppressHydrationWarning: true }) : children
|
|
)
|
|
);
|