doc.yeswiki.pro/node_modules/preact/compat/client.js
2023-05-20 19:38:02 +03:00

19 lines
397 B
JavaScript

const { render, hydrate, unmountComponentAtNode } = require('preact/compat');
function createRoot(container) {
return {
render(children) {
render(children, container);
},
unmount() {
unmountComponentAtNode(container);
}
};
}
exports.createRoot = createRoot;
exports.hydrateRoot = function (container, children) {
hydrate(children, container);
return createRoot(container);
};