You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
400 B

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