1 | const { render, hydrate, unmountComponentAtNode } = require('preact/compat');
|
2 |
|
3 | function createRoot(container) {
|
4 | return {
|
5 | render(children) {
|
6 | render(children, container);
|
7 | },
|
8 | unmount() {
|
9 | unmountComponentAtNode(container);
|
10 | }
|
11 | };
|
12 | }
|
13 |
|
14 | exports.createRoot = createRoot;
|
15 |
|
16 | exports.hydrateRoot = function(container, children) {
|
17 | hydrate(children, container);
|
18 | return createRoot(container);
|
19 | };
|