File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1- const { render, hydrate } = require ( 'preact/compat' ) ;
1+ const { render, hydrate, unmountComponentAtNode } = require ( 'preact/compat' ) ;
22
3- exports . createRoot = function ( container ) {
3+ function createRoot ( container ) {
44 return {
55 render ( children ) {
6- return render ( children , container ) ;
6+ render ( children , container ) ;
7+ } ,
8+ unmount ( ) {
9+ unmountComponentAtNode ( container ) ;
710 }
811 } ;
9- } ;
12+ }
13+
14+ exports . createRoot = createRoot ;
1015
1116exports . hydrateRoot = function ( container , children ) {
12- return hydrate ( children , container ) ;
17+ hydrate ( children , container ) ;
18+ return createRoot ( container ) ;
1319} ;
Original file line number Diff line number Diff line change 1- import { render , hydrate } from 'preact/compat'
1+ import { render , hydrate , unmountComponentAtNode } from 'preact/compat'
22
33export function createRoot ( container ) {
44 return {
55 render ( children ) {
6- return render ( children , container )
6+ render ( children , container )
7+ } ,
8+ unmount ( ) {
9+ unmountComponentAtNode ( container )
710 }
811 }
912}
1013
1114export function hydrateRoot ( container , children ) {
12- return hydrate ( children , container ) ;
15+ hydrate ( children , container )
16+ return createRoot ( container )
1317}
You can’t perform that action at this time.
0 commit comments