mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/JiboViteDocs.git
synced 2026-06-15 18:16:18 +00:00
22 lines
479 B
JavaScript
22 lines
479 B
JavaScript
const { render, hydrate, unmountComponentAtNode } = require('preact/compat');
|
|
|
|
function createRoot(container) {
|
|
return {
|
|
// eslint-disable-next-line
|
|
render: function (children) {
|
|
render(children, container);
|
|
},
|
|
// eslint-disable-next-line
|
|
unmount: function () {
|
|
unmountComponentAtNode(container);
|
|
}
|
|
};
|
|
}
|
|
|
|
exports.createRoot = createRoot;
|
|
|
|
exports.hydrateRoot = function (container, children) {
|
|
hydrate(children, container);
|
|
return createRoot(container);
|
|
};
|