diff options
author | 2023-05-04 15:23:00 +0100 | |
---|---|---|
committer | 2023-05-04 15:23:00 +0100 | |
commit | ca329bbcae7a6075af4f428f6f64466e9d152c8f (patch) | |
tree | 0139a99c0cc60b22758e75ebb519893a5447ebb2 /packages/integrations/react/client.js | |
parent | dfb9e4270a7c05c292a549777408278fcbe162ab (diff) | |
download | astro-ca329bbcae7a6075af4f428f6f64466e9d152c8f.tar.gz astro-ca329bbcae7a6075af4f428f6f64466e9d152c8f.tar.zst astro-ca329bbcae7a6075af4f428f6f64466e9d152c8f.zip |
Generate unique ids within each React island (#6976)
Diffstat (limited to 'packages/integrations/react/client.js')
-rw-r--r-- | packages/integrations/react/client.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/integrations/react/client.js b/packages/integrations/react/client.js index 3807ab410..366d499e3 100644 --- a/packages/integrations/react/client.js +++ b/packages/integrations/react/client.js @@ -13,6 +13,9 @@ function isAlreadyHydrated(element) { export default (element) => (Component, props, { default: children, ...slotted }, { client }) => { if (!element.hasAttribute('ssr')) return; + const renderOptions = { + identifierPrefix: element.getAttribute('prefix') + } for (const [key, value] of Object.entries(slotted)) { props[key] = createElement(StaticHtml, { value, name: key }); } @@ -28,10 +31,10 @@ export default (element) => } if (client === 'only') { return startTransition(() => { - createRoot(element).render(componentEl); + createRoot(element, renderOptions).render(componentEl); }); } return startTransition(() => { - hydrateRoot(element, componentEl); + hydrateRoot(element, componentEl, renderOptions); }); }; |