Skip to content

Conversation

zaicevas
Copy link
Contributor

In https://github.com/testing-library/react-hooks-testing-library/blob/main/README.md there are two reasons when not to use react-hooks-testing-library:

  1. Your hook is defined alongside a component and is only used there 2. Your hook is easy to test by just testing the components using it

I think it still holds true and it would make sense to add this into renderHook docs. I've omitted the first point because it seems like the second point covers it. We could add both, though.

libraries publishing hooks. You should prefer `render` since a custom test
libraries publishing hooks.

Do not use `renderHook` when your hook is easy to test by just testing the components using it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Do not use `renderHook` when your hook is easy to test by just testing the components using it.
Do not use `renderHook` when your hook can be easily tested by testing the components using it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zaicevas!
A minor suggestion here.

libraries publishing hooks.

Do not use `renderHook` when your hook is easy to test by just testing the components using it.
Alternatively, you should prefer `render` since a custom test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "alternatively" really needed here? I think we can remove it :)

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.

2 participants