Skip to content

Commit 18008d5

Browse files
committed
Revert "Update docs"
This reverts commit 482ee46.
1 parent 2b02d31 commit 18008d5

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

docs/usage/advanced-hooks.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,19 @@ import { renderHook, act } from '@testing-library/react-hooks'
4040
import { CounterStepProvider, useCounter } from './counter'
4141

4242
test('should use custom step when incrementing', () => {
43-
const wrapper = ({ children, step }) => (
44-
<CounterStepProvider step={step}>{children}</CounterStepProvider>
45-
)
46-
const { result, rerender } = renderHook(() => useCounter(), {
47-
wrapper,
48-
initialProps: {
49-
step: 2
50-
}
51-
})
43+
const wrapper = ({ children }) => <CounterStepProvider step={2}>{children}</CounterStepProvider>
44+
const { result } = renderHook(() => useCounter(), { wrapper })
5245

5346
act(() => {
5447
result.current.increment()
5548
})
5649

5750
expect(result.current.count).toBe(2)
58-
59-
rerender({ step: -2 })
60-
61-
act(() => {
62-
result.current.increment()
63-
})
64-
65-
expect(result.current.count).toBe(0)
6651
})
6752
```
6853

69-
The `wrapper` option will accept any React component and access the `initialProps` option and new
70-
props from `rerender` method as its properties, but it **must** render `children` in order for the
71-
test component to render and the hook to execute.
54+
The `wrapper` option will accept any React component, but it **must** render `children` in order for
55+
the test component to render and the hook to execute.
7256

7357
### ESLint Warning
7458

0 commit comments

Comments
 (0)