Skip to content

Commit 3e76c27

Browse files
justin808claude
andcommitted
docs: add missing client-only hooks to RSC audit checklist
Add useLayoutEffect, useInsertionEffect, useImperativeHandle, and useSyncExternalStore to the React hooks list and the audit grep checklist. These hooks are client-only and would fail at runtime with "hook is not a function" in a mis-classified Server Component. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fb5bc4f commit 3e76c27

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/pro/react-server-components/upgrading-existing-pro-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Before running the generator, audit your existing components to identify which o
3838

3939
Components that use any of the following **must** have `'use client'`:
4040

41-
- **React hooks** (`import { ... } from 'react'`): `useState`, `useEffect`, `useContext`, `useRef`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useOptimistic`
41+
- **React hooks** (`import { ... } from 'react'`): `useState`, `useEffect`, `useLayoutEffect`, `useInsertionEffect`, `useContext`, `useRef`, `useImperativeHandle`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useSyncExternalStore`, `useOptimistic`
4242
- **React DOM hooks** (`import { ... } from 'react-dom'`): `useFormStatus`
4343
- **React on Rails client APIs**: `ReactOnRails.getStore()`, `ReactOnRails.authenticityToken()`
4444
- **Redux**: `useSelector`, `useDispatch`, `connect()`, `<Provider>`
@@ -71,7 +71,7 @@ There is no warning when a component is auto-classified as a server component. I
7171

7272
Before proceeding to Step 1:
7373

74-
- [ ] Search your component source files for `useState`, `useEffect`, `useContext`, `useRef`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useOptimistic`, `useFormStatus`, `useSelector`, `useDispatch`, `useNavigate`, `useLocation`, `useParams`, `ReactOnRails.getStore`, `ReactOnRails.authenticityToken`
74+
- [ ] Search your component source files for `useState`, `useEffect`, `useLayoutEffect`, `useInsertionEffect`, `useContext`, `useRef`, `useImperativeHandle`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useSyncExternalStore`, `useOptimistic`, `useFormStatus`, `useSelector`, `useDispatch`, `useNavigate`, `useLocation`, `useParams`, `ReactOnRails.getStore`, `ReactOnRails.authenticityToken`
7575
- [ ] Check all `.server.jsx` files -- these almost certainly need `'use client'`
7676
- [ ] Check components that use `StaticRouter` (SSR wrapper, not a client API — but the file likely uses other client APIs)
7777
- [ ] Verify no component relies on browser globals (`window`, `document`) without `'use client'`

0 commit comments

Comments
 (0)