1
2
3
4
5
6
7
8
9
10
11
12
const island = document.querySelector("[data-hydration-src]");
if (!island) {
throw new Error("Could not find island");
}
const { hydrateRoot } = await import("https://esm.sh/react-dom@18.2.0/client");
const { jsx: _jsx } = await import("https://esm.sh/react@18.2.0/jsx-runtime");
const src = island.getAttribute("data-hydration-src");
console.log(`hydrating ${src}`);
const { Component } = await import(src);
const props = JSON.parse(island.getAttribute("data-hydration-props"));
hydrateRoot(island, _jsx(Component, props));
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 16, 2024