doc.yeswiki.pro/node_modules/preact/compat/client.js

20 lines
397 B
JavaScript
Raw Normal View History

2023-05-20 16:37:42 +00:00
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);
};