diff options
author | 2022-03-31 09:51:29 -0700 | |
---|---|---|
committer | 2022-03-31 12:51:29 -0400 | |
commit | 57f48b27019bbad5c8d61808291dc8bc6cdedb52 (patch) | |
tree | 99c57190e625bdca4c03d86d14795a3a47fd98c3 /packages/integrations/react/client.js | |
parent | 25c1abff10a9b46468b750ab967e9b8be44ac38a (diff) | |
download | astro-57f48b27019bbad5c8d61808291dc8bc6cdedb52.tar.gz astro-57f48b27019bbad5c8d61808291dc8bc6cdedb52.tar.zst astro-57f48b27019bbad5c8d61808291dc8bc6cdedb52.zip |
Add support for React 18 in @astrojs/react (#2947)
* 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>
Diffstat (limited to 'packages/integrations/react/client.js')
-rw-r--r-- | packages/integrations/react/client.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/integrations/react/client.js b/packages/integrations/react/client.js index a6bc7d3bc..11d63cfcb 100644 --- a/packages/integrations/react/client.js +++ b/packages/integrations/react/client.js @@ -1,13 +1,13 @@ import { createElement } from 'react'; -import { hydrate } from 'react-dom'; +import { hydrateRoot } from 'react-dom/client'; import StaticHtml from './static-html.js'; export default (element) => (Component, props, children) => - hydrate( + hydrateRoot( + element, createElement( Component, { ...props, suppressHydrationWarning: true }, children != null ? createElement(StaticHtml, { value: children, suppressHydrationWarning: true }) : children - ), - element + ) ); |