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
Testing hooks should support hooks with multiple parameters. Currently, the option "initialProps" of renderHook, and the "rerender" function it returns are supporting only a single parameter.
Suggested implementation:
Obviously, for backwards compatibility, the option "initialProps" cannot be changed. Therefore, I suggest to add a new option "initialArgs" that is an array and renders the hook to be tested by spreading that array.
The function "rerender" returned from "renderHook" will take multiple parameters and forward them to the hook as well.
Describe the feature you'd like:
Testing hooks should support hooks with multiple parameters. Currently, the option "initialProps" of
renderHook
, and the "rerender" function it returns are supporting only a single parameter.Suggested implementation:
Obviously, for backwards compatibility, the option "initialProps" cannot be changed. Therefore, I suggest to add a new option "initialArgs" that is an array and renders the hook to be tested by spreading that array.
The function "rerender" returned from "renderHook" will take multiple parameters and forward them to the hook as well.
It should be an error (exception) to pass both options "initialProps" and "initialArgs" at the same time.
Describe alternatives you've considered:
As a workaround, I currently wrap my multi-arg hooks in a wrapper hook taking an array as "props", but that is cumbersome:
Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: