Skip to content

feat: add support for multiple arguments in renderHook() #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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