React Testing Library · Function
renderHook
renderHook renders a React hook in a test component and exposes its latest value. Use result.current to inspect the value, rerender to change props, and unmount to remove the hook.
Last updated
Syntax
function renderHook<Result, Props, Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(render: (initialProps: Props) => Result, options?: RenderHookOptions<Props, Q, Container, BaseElement>): RenderHookResult<Result, Props>In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
renderrerenderunmountresultconfigure