You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: website/docs/13.x-next/docs/api/misc/render-hook.mdx
+7-2
Original file line number
Diff line number
Diff line change
@@ -45,15 +45,20 @@ The `props` passed into the callback will be the `initialProps` provided in the
45
45
46
46
A `RenderHookOptions<Props>` object to modify the execution of the `callback` function, containing the following properties:
47
47
48
-
### `initialProps`
48
+
### `initialProps`{#initial-props}
49
49
50
50
The initial values to pass as `props` to the `callback` function of `renderHook`. The `Props` type is determined by the type passed to or inferred by the `renderHook` call.
51
51
52
52
### `wrapper`
53
53
54
54
A React component to wrap the test component in when rendering. This is usually used to add context providers from `React.createContext` for the hook to access with `useContext`.
55
55
56
-
## `RenderHookResult`
56
+
### `concurrentRoot`{#concurrent-root}
57
+
58
+
Set to `false` to disable concurrent rendering.
59
+
Otherwise, `render` will default to using concurrent rendering used in the React Native New Architecture.
Copy file name to clipboardexpand all lines: website/docs/13.x-next/docs/api/render.mdx
+6-6
Original file line number
Diff line number
Diff line change
@@ -20,32 +20,32 @@ test('basic test', () => {
20
20
21
21
> When using React context providers, like Redux Provider, you'll likely want to wrap rendered component with them. In such cases, it's convenient to create your own custom `render` method. [Follow this great guide on how to set this up](https://testing-library.com/docs/react-testing-library/setup#custom-render).
22
22
23
-
###Options{#render-options}
23
+
## Options
24
24
25
25
The behavior of the `render` method can be customized by passing various options as a second argument of the `RenderOptions` type:
26
26
27
-
####`wrapper` option
27
+
### `wrapper` option
28
28
29
29
```ts
30
30
wrapper?:React.ComponentType<any>,
31
31
```
32
32
33
33
This option allows you to wrap the tested component, passed as the first option to the `render()` function, in an additional wrapper component. This is useful for creating reusable custom render functions for common React Context providers.
34
34
35
-
####`concurrentRoot` option {#concurrent-root}
35
+
### `concurrentRoot` option {#concurrent-root}
36
36
37
37
Set to `false` to disable concurrent rendering.
38
38
Otherwise, `render` will default to using concurrent rendering used in the React Native New Architecture.
This option allows you to pass `createNodeMock` option to `ReactTestRenderer.create()` method in order to allow for custom mock refs. You can learn more about this option from [React Test Renderer documentation](https://reactjs.org/docs/test-renderer.html#ideas).
@@ -59,7 +59,7 @@ This **experimental** option allows you to replicate React Native behavior of th
59
59
60
60
React Test Renderer does not enforce this check; hence, by default, React Native Testing Library also does not check this. That might result in runtime errors when running your code on a device, while the code works without errors in tests.
61
61
62
-
###Result{#render-result}
62
+
## Result
63
63
64
64
The `render` function returns the same queries and utilities as the [`screen`](docs/api/screen) object. We recommended using the `screen` object as more developer-friendly way.
0 commit comments