File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function createServerRenderer<TProps, TResult>(
13
13
) {
14
14
let renderProps : TProps | undefined
15
15
let container : HTMLDivElement | undefined
16
- let serverOutput : string = ''
16
+ let serverOutput = ''
17
17
const testHarness = createTestHarness ( rendererProps , wrapper , false )
18
18
19
19
return {
@@ -33,7 +33,7 @@ function createServerRenderer<TProps, TResult>(
33
33
} else {
34
34
container . innerHTML = serverOutput
35
35
act ( ( ) => {
36
- ReactDOM . hydrate ( testHarness ( renderProps ) , container ! )
36
+ ReactDOM . hydrate ( testHarness ( renderProps ) , container || null )
37
37
} )
38
38
}
39
39
} ,
@@ -42,13 +42,15 @@ function createServerRenderer<TProps, TResult>(
42
42
throw new Error ( 'You must hydrate the component before you can rerender' )
43
43
}
44
44
act ( ( ) => {
45
- ReactDOM . render ( testHarness ( props ) , container ! )
45
+ ReactDOM . render ( testHarness ( props ) , container || null )
46
46
} )
47
47
} ,
48
48
unmount ( ) {
49
49
if ( container ) {
50
50
act ( ( ) => {
51
- ReactDOM . unmountComponentAtNode ( container ! )
51
+ if ( typeof container !== 'undefined' ) {
52
+ ReactDOM . unmountComponentAtNode ( container )
53
+ }
52
54
} )
53
55
}
54
56
} ,
You can’t perform that action at this time.
0 commit comments