Skip to content

Commit d26e8ca

Browse files
Update docs with reactStrictMode in render (#1479)
1 parent f4eb6a5 commit d26e8ca

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/react-testing-library/api.mdx

+15-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ as these methods:
1616
- [`onRecoverableError`](#onrecoverableerror)
1717
- [`wrapper`](#wrapper)
1818
- [`queries`](#queries)
19+
- [`reactStrictMode`](#render-options-reactstrictmode)
1920
- [`render` Result](#render-result)
2021
- [`...queries`](#queries-1)
2122
- [`container`](#container-1)
@@ -31,7 +32,8 @@ as these methods:
3132
- [`initialProps`](#initialprops)
3233
- [`onCaughtError`](#oncaughterror)
3334
- [`onRecoverableError`](#onrecoverableerror)
34-
- [`wrapper`](#wrapper-1)
35+
- [`wrapper`](#renderhook-options-wrapper)
36+
- [`reactStrictMode`](#renderhook-options-reactstrictmode)
3537
- [`renderHook` Result](#renderhook-result)
3638
- [`result`](#result)
3739
- [`rerender`](#rerender-1)
@@ -161,6 +163,11 @@ utility functions to create custom queries.
161163
Custom queries can also be added globally by following the
162164
[custom render guide](setup.mdx#custom-render).
163165

166+
### `render` Options `reactStrictMode`
167+
168+
When enabled, [`<StrictMode>`](https://react.dev/reference/react/StrictMode) is rendered around the inner element.
169+
If defined, overrides the value of `reactStrictMode` set in [`configure`](https://testing-library.com/docs/react-testing-library/api/#configure-options).
170+
164171
## `render` Result
165172

166173
The `render` method returns an object that has a few properties:
@@ -431,6 +438,11 @@ Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https:
431438

432439
See [`wrapper` option for `render`](#wrapper)
433440

441+
442+
### `renderHook` Options `reactStrictMode`
443+
444+
See [`reactStrictMode` option for `render`](#render-options-reactstrictmode)
445+
434446
## `renderHook` Result
435447

436448
The `renderHook` method returns an object that has a few properties:
@@ -503,3 +515,5 @@ configure({reactStrictMode: true})
503515

504516
When enabled, [`<StrictMode>`](https://react.dev/reference/react/StrictMode) is
505517
rendered around the inner element. Defaults to `false`.
518+
519+
This setting can be changed for a single test by providing `reactStrictMode` in the options argument of the [`render`](#render-options-reactstrictmode) function.

0 commit comments

Comments
 (0)