client.mjs 489 B

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