Merge pull request #1044 from elliotwaite/docs-fix

Clarify hooks rules to mention early returns
This commit is contained in:
Jon Kelley 2023-05-29 15:03:09 +02:00 committed by GitHub
commit 9db13f5823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ This is only possible because the two hooks are always called in the same order,
1. Hooks may be only used in components or other hooks (we'll get to that later)
2. On every call to the component function
1. The same hooks must be called
1. The same hooks must be called (except in the case of early returns, as explained later in the [Error Handling chapter](../best_practices/error_handling.md))
2. In the same order
3. Hooks name's should start with `use_` so you don't accidentally confuse them with regular functions