Skip to content

Commit d621cda

Browse files
authored
Remove destructuring of testRenderer
1 parent 21a1c6e commit d621cda

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/pure.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,25 @@ function renderHook<TProps, TResult>(
8989
</Suspense>
9090
) as ReactElement
9191

92-
let testRenderer: ReactTestRenderer | undefined
92+
let testRenderer: ReactTestRenderer
9393
// eslint-disable-next-line @typescript-eslint/no-floating-promises
9494
act(() => {
9595
testRenderer = create(toRender())
9696
})
97-
// eslint-disable-next-line @typescript-eslint/unbound-method
98-
const { unmount, update } = testRenderer as ReactTestRenderer
99-
97+
10098
function rerenderHook(newProps: typeof initialProps = hookProps.current) {
10199
hookProps.current = newProps
102100
// eslint-disable-next-line @typescript-eslint/no-floating-promises
103101
act(() => {
104-
update(toRender())
102+
testRenderer.update(toRender())
105103
})
106104
}
107105

108106
function unmountHook() {
109107
// eslint-disable-next-line @typescript-eslint/no-floating-promises
110108
act(() => {
111109
removeCleanup(unmountHook)
112-
unmount()
110+
testRenderer.unmount()
113111
})
114112
}
115113

0 commit comments

Comments
 (0)