Skip to content

Conversation

danielrentz
Copy link

@danielrentz danielrentz commented Jun 20, 2025

What:

Add support for multiple arguments for function renderHook. Fixes #1350.

Why:

Hooks can take multiple arguments. The current implementation assumes a single argument (derived from render taking a single "props" for rendering components).

How:

Change renderHook to take a new array option "initialArgs". Option "initialProps" remains in place for backward compat. The options are mutually exclusive.
The "rerender" function returned from "renderHooks" accepts multiple arguments as well.

Checklist:

Comments:

This is a redo of PR #1386 which lacks correct TS typings, tests for TS typings, documentation update, and seems to be abandoned.

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b5f7249:

Sandbox Source
react-testing-library-examples Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

renderHook support for multiple parameters
1 participant