Skip to content

Commit f59f568

Browse files
committed
refactor: revert examples
1 parent 8abd2f0 commit f59f568

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

docs/api-reference.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ route: '/reference/api'
1818
## `renderHook`
1919

2020
```ts
21-
renderHook: (
21+
function renderHook(
2222
callback: (props?: any): any,
2323
options?: RenderHookOptions
24-
) => RenderHookResult
24+
): RenderHookResult
2525
```
2626

2727
Renders a test component that will call the provided `callback`, including any hooks it calls, every
@@ -79,7 +79,7 @@ returned at the time.
7979
### `rerender`
8080

8181
```ts
82-
rerender: (newProps?: any) => void
82+
function rerender(newProps?: any): void
8383
```
8484

8585
A function to rerender the test component, causing any hooks to be recalculated. If `newProps` are
@@ -88,7 +88,7 @@ passed, they will replace the `callback` function's `initialProps` for subsequen
8888
### `unmount`
8989

9090
```ts
91-
unmount: () => void
91+
function unmount(): void
9292
```
9393

9494
A function to unmount the test component. This is commonly used to trigger cleanup effects for
@@ -97,7 +97,7 @@ A function to unmount the test component. This is commonly used to trigger clean
9797
### `hydrate`
9898

9999
```ts
100-
hydrate: () => void
100+
function hydrate(): void
101101
```
102102

103103
> This is only used when using the `server` module. See [Rendering](/renderer) for more information
@@ -122,7 +122,7 @@ exported from your chosen renderer. Although, they both work the same.
122122
## `cleanup`
123123

124124
```ts
125-
cleanup: () => Promise<void>
125+
function cleanup(): Promise<void>
126126
```
127127

128128
Unmounts any rendered hooks rendered with `renderHook`, ensuring all effects have been flushed. Any
@@ -170,7 +170,7 @@ variable to `true` before importing `@testing-library/react-hooks` will also dis
170170
## `addCleanup`
171171

172172
```ts
173-
addCleanup: (callback: () => void | Promise<void>) => () => void
173+
function addCleanup(callback: () => void | Promise<void>): (): void
174174
```
175175

176176
Add a callback to be called during [`cleanup`](/reference/api#cleanup), returning a function to
@@ -187,7 +187,7 @@ be resolved before moving onto the next cleanup callback.
187187
## `removeCleanup`
188188

189189
```ts
190-
removeCleanup: (callback: () => void | Promise<void>) => void
190+
function removeCleanup(callback: () => void | Promise<void>): void
191191
```
192192

193193
Removes a cleanup callback previously added with [`addCleanup`](/reference/api#addCleanup). Once
@@ -201,7 +201,7 @@ removed, the provided callback will no longer execute as part of running
201201
### `waitForNextUpdate`
202202

203203
```ts
204-
waitForNextUpdate: (options?: { timeout?: number }) => Promise<void>
204+
function waitForNextUpdate(options?: { timeout?: number }): Promise<void>
205205
```
206206

207207
Returns a `Promise` that resolves the next time the hook renders, commonly when state is updated as
@@ -213,12 +213,15 @@ The maximum amount of time in milliseconds (ms) to wait. By default, no timeout
213213

214214
### `waitFor`
215215

216-
```js
217-
waitFor: (callback: () => boolean | void, options?: {
218-
interval?: number,
219-
timeout?: number,
220-
suppressErrors?: boolean
221-
}) => Promise<void>
216+
```ts
217+
function waitFor(
218+
callback: () => boolean | void,
219+
options?: {
220+
interval?: number
221+
timeout?: number
222+
suppressErrors?: boolean
223+
}
224+
): Promise<void>
222225
```
223226

224227
Returns a `Promise` that resolves if the provided callback executes without exception and returns a
@@ -243,12 +246,15 @@ rejected. By default, errors are suppressed for this utility.
243246

244247
### `waitForValueToChange`
245248

246-
```js
247-
waitForValueToChange: (selector: () => any, options?: {
248-
interval?: number,
249-
timeout?: number,
250-
suppressErrors?: boolean
251-
}) => Promise<void>
249+
```ts
250+
function waitForValueToChange(
251+
selector: () => any,
252+
options?: {
253+
interval?: number
254+
timeout?: number
255+
suppressErrors?: boolean
256+
}
257+
): Promise<void>
252258
```
253259

254260
Returns a `Promise` that resolves if the value returned from the provided selector changes. It is

docs/renderer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ While calling `renderHook` from `@testing-library/react-hooks/native` and
5555
additional function:
5656
5757
```ts
58-
hydrate: () => void
58+
function hydrate(): void
5959
```
6060

6161
For more information on `hydrate` see the [API documentation](/reference/api#hydrate)

0 commit comments

Comments
 (0)