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