mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
57f48b2701
* 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 5279b7249c
.
* 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>
13 lines
416 B
JavaScript
13 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
|
|
)
|
|
);
|