Skip to content

Commit a8d1e1b

Browse files
committed
docs: update description for prefer-use-state-lazy-initialization
1 parent 6bd2b99 commit a8d1e1b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

website/pages/docs/rules/hooks-extra-prefer-use-state-lazy-initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ react-hooks-extra/prefer-use-state-lazy-initialization
2424

2525
## What it does
2626

27-
Warns function calls made inside `useState` calls.
27+
Enforces function calls made inside `useState` to be wrapped in an `initializer function`.
2828

2929
A function can be invoked inside a useState call to help create its initial state. However, subsequent renders will still invoke the function while discarding its return value. This is wasteful and can cause performance issues if the function call is expensive.
3030

website/pages/docs/rules/overview.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@
109109

110110
## Hooks Extra Rules
111111

112-
| Rule || Features | Description |
113-
| :------------------------------------------------------------------------------------------------- | :- | :------- | :------------------------------------------------------------------------------ |
114-
| [`no-direct-set-state-in-use-effect`](hooks-extra-no-direct-set-state-in-use-effect) | 1️⃣ | `🔍` | Disallow direct calls to the `set` function of `useState` in `useEffect`. |
115-
| [`no-direct-set-state-in-use-layout-effect`](hooks-extra-no-direct-set-state-in-use-layout-effect) | 0️⃣ | `🔍` | Disallow direct calls to the `set` function of `useState` in `useLayoutEffect`. |
116-
| [`no-unnecessary-use-callback`](hooks-extra-no-unnecessary-use-callback) | 0️⃣ | `🔍` | Disallow unnecessary usage of `useCallback`. |
117-
| [`no-unnecessary-use-memo`](hooks-extra-no-unnecessary-use-memo) | 0️⃣ | `🔍` | Disallow unnecessary usage of `useMemo`. |
118-
| [`no-useless-custom-hooks`](hooks-extra-no-useless-custom-hooks) | 1️⃣ | `🔍` | Enforces custom Hooks to use at least one other Hook. |
119-
| [`prefer-use-state-lazy-initialization`](hooks-extra-prefer-use-state-lazy-initialization) | 1️⃣ | `🔍` | Warns function calls made inside `useState` calls. |
112+
| Rule || Features | Description |
113+
| :------------------------------------------------------------------------------------------------- | :- | :------- | :----------------------------------------------------------------------------------------- |
114+
| [`no-direct-set-state-in-use-effect`](hooks-extra-no-direct-set-state-in-use-effect) | 1️⃣ | `🔍` | Disallow direct calls to the `set` function of `useState` in `useEffect`. |
115+
| [`no-direct-set-state-in-use-layout-effect`](hooks-extra-no-direct-set-state-in-use-layout-effect) | 0️⃣ | `🔍` | Disallow direct calls to the `set` function of `useState` in `useLayoutEffect`. |
116+
| [`no-unnecessary-use-callback`](hooks-extra-no-unnecessary-use-callback) | 0️⃣ | `🔍` | Disallow unnecessary usage of `useCallback`. |
117+
| [`no-unnecessary-use-memo`](hooks-extra-no-unnecessary-use-memo) | 0️⃣ | `🔍` | Disallow unnecessary usage of `useMemo`. |
118+
| [`no-useless-custom-hooks`](hooks-extra-no-useless-custom-hooks) | 1️⃣ | `🔍` | Enforces custom Hooks to use at least one other Hook inside. |
119+
| [`prefer-use-state-lazy-initialization`](hooks-extra-prefer-use-state-lazy-initialization) | 1️⃣ | `🔍` | Enforces function calls made inside `useState` to be wrapped in an `initializer function`. |
120120

121121
### Deprecated
122122

0 commit comments

Comments
 (0)