@@ -2,27 +2,27 @@ import React from "react";
22import ReactDOM from "react-dom" ;
33
44export function bind ( node ) {
5- return {
6- create : ( type , props , children ) =>
7- React . createElement ( type , props , ...children ) ,
8- render : ( element ) => {
9- ReactDOM . render ( element , node ) ;
10- } ,
11- unmount : ( ) => ReactDOM . unmountComponentAtNode ( node ) ,
12- } ;
5+ return {
6+ create : ( type , props , children ) =>
7+ React . createElement ( type , props , ...children ) ,
8+ render : ( element ) => {
9+ ReactDOM . render ( element , node ) ;
10+ } ,
11+ unmount : ( ) => ReactDOM . unmountComponentAtNode ( node ) ,
12+ } ;
1313}
1414
1515export function History ( { onChange } ) {
16- // Capture changes to the browser's history
17- React . useEffect ( ( ) => {
18- const listener = ( ) => {
19- onChange ( {
20- pathname : window . location . pathname ,
21- search : window . location . search ,
22- } ) ;
23- } ;
24- window . addEventListener ( "popstate" , listener ) ;
25- return ( ) => window . removeEventListener ( "popstate" , listener ) ;
26- } ) ;
27- return null ;
16+ // Capture changes to the browser's history
17+ React . useEffect ( ( ) => {
18+ const listener = ( ) => {
19+ onChange ( {
20+ pathname : window . location . pathname ,
21+ search : window . location . search ,
22+ } ) ;
23+ } ;
24+ window . addEventListener ( "popstate" , listener ) ;
25+ return ( ) => window . removeEventListener ( "popstate" , listener ) ;
26+ } ) ;
27+ return null ;
2828}
0 commit comments