Skip to content

Commit

Permalink
Link FAQ to testing recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Aug 10, 2019
1 parent 12a8402 commit 7382e4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions content/docs/hooks-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Importantly, custom Hooks give you the power to constrain React API if you'd lik

From React's point of view, a component using Hooks is just a regular component. If your testing solution doesn't rely on React internals, testing components with Hooks shouldn't be different from how you normally test components.

>Note
>
>[Testing Recipes](/docs/testing-recipes.html) include many examples that you can copy and paste.
For example, let's say we have this counter component:

```js
Expand Down Expand Up @@ -182,6 +186,8 @@ If you need to test a custom Hook, you can do so by creating a component in your

To reduce the boilerplate, we recommend using [React Testing Library](https://testing-library.com/react) which is designed to encourage writing tests that use your components as the end users do.

For more information, check out [Testing Recipes](/docs/testing-recipes.html).

### What exactly do the [lint rules](https://www.npmjs.com/package/eslint-plugin-react-hooks) enforce? {#what-exactly-do-the-lint-rules-enforce}

We provide an [ESLint plugin](https://www.npmjs.com/package/eslint-plugin-react-hooks) that enforces [rules of Hooks](/docs/hooks-rules.html) to avoid bugs. It assumes that any function starting with "`use`" and a capital letter right after it is a Hook. We recognize this heuristic isn't perfect and there may be some false positives, but without an ecosystem-wide convention there is just no way to make Hooks work well -- and longer names will discourage people from either adopting Hooks or following the convention.
Expand Down

0 comments on commit 7382e4e

Please sign in to comment.