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
401 B
JavaScript
13 lines
401 B
JavaScript
import { createElement } from 'react';
|
|
import { hydrate } from 'react-dom';
|
|
import StaticHtml from './static-html.js';
|
|
|
|
export default (element) => (Component, props, children) =>
|
|
hydrate(
|
|
createElement(
|
|
Component,
|
|
{ ...props, suppressHydrationWarning: true },
|
|
children != null ? createElement(StaticHtml, { value: children, suppressHydrationWarning: true }) : children
|
|
),
|
|
element
|
|
);
|