UNPKG

407 BJavaScriptView Raw
1import { render, hydrate, unmountComponentAtNode } from 'preact/compat';
2
3export function createRoot(container) {
4 return {
5 render(children) {
6 render(children, container);
7 },
8 unmount() {
9 unmountComponentAtNode(container);
10 }
11 };
12}
13
14export function hydrateRoot(container, children) {
15 hydrate(children, container);
16 return createRoot(container);
17}
18
19export default {
20 createRoot,
21 hydrateRoot
22};