"this" should not be used in functional components
Ensure that 'this' is not used in functional components. Functional components do not have a 'this' context. Use props and destructuring for data access instead.
error-handlingstack-react
High
Avoid array indexes as keys in React lists
Ensure that React list items do not use array indexes as keys. This practice can cause reordering issues and unexpected behavior. Recommend using unique identifiers instead.
performance-efficiencystack-react+1
High
Avoid using .bind() or arrow functions in JSX props
Detect the use of .bind() or inline arrow functions inside JSX props. These create new functions on every render, impacting performance. Suggest moving function definitions outside the render method.
performance-efficiencystack-react
High
Do not nest React components
Check if React components are defined inside other components. Nested components are recreated on every render, causing unnecessary re-renders. Suggest moving them outside the parent component.
performance-efficiencystack-react+1
High
Ensure JSX list components have a key property
Check that JSX list components have unique key properties. Missing keys can cause unnecessary re-renders and lead to state inconsistencies.
performance-efficiencystack-react+1
High
Ensure React list keys are stable between renders
Check if React list keys are stable and unique. Using dynamic values like Math.random() or Date.now() can cause rendering issues. Recommend using unique IDs.
performance-efficiencystack-react+1
High
Keep 'use client' at the leaf: default to Server Components
Prefer Server Components for pages/layouts and move interactivity to small leaf Client Components. Only add 'use client' where browser APIs or event handlers are strictly necessary.
stack-nextjsstack-react+2
High
Make fetch caching explicit in Server Components
For dynamic data use { cache: 'no-store' } or file-level dynamic = 'force-dynamic'. For ISR use { next: { revalidate: N, tags: [...] } }.
stack-nextjsstack-react+2
High
Middleware only for light auth/rewrites
Keep middleware fast and side-effect free (no DB writes). Narrow the matcher and skip static assets. Use Route Handlers for heavy logic.
stack-nextjsstack-react+2
High
Never expose secrets to the client
Read secrets (process.env.*) only in Server Components, Route Handlers, or server actions. Client Components must use ONLY NEXT_PUBLIC_* variables.
stack-nextjsstack-react+3
High
React "render" functions should return a value
Ensure that React class components' render functions return a value. Forgetting a return statement results in missing UI elements and potential bugs.
error-handlingstack-react+1
High
React children should not be passed as props
Check if React children are passed as regular props instead of being nested inside components. Passing them incorrectly can cause conflicts and reduce clarity.
readability-refactorstack-react+1
High
React Context values should have stable identities
Identify cases where React Context values are being reassigned dynamically. Unstable context values trigger unnecessary re-renders. Use memoization to stabilize them.
performance-efficiencystack-react+1
High
Read headers/cookies only on the server
Use headers() and cookies() in Server Components, Route Handlers, or server actions; never in Client Components.
stack-nextjsstack-react+2
High
Revalidate after mutations to keep UI cache coherent
After server-side mutations, call revalidatePath or revalidateTag to refresh cached RSC data.
stack-nextjsstack-react+2
High
Use next/image with explicit dimensions and alt
Always use the Next.js Image component for images with width/height (or fill) and meaningful alt text. Avoid plain <img> for app assets.
stack-nextjsstack-react+3
High
Use Route Handlers in app/api with NextResponse
Prefer app/api route handlers over legacy pages/api. Return NextResponse.json, validate input, and handle allowed HTTP methods explicitly.
stack-nextjsstack-react+2
High
Validate inputs on the server (zod) in Route Handlers/Actions
Validate and sanitize all request bodies and search params on the server using a schema (e.g., zod). Reject invalid payloads with proper status.
stack-nextjsstack-react+2
Low
Dynamic import for heavy client-only widgets
Use next/dynamic with { ssr: false } for large client-only components (maps, editors) and provide a lightweight loading fallback.
stack-nextjsstack-react+2
Low
Internationalize user-facing text with next-intl or next-i18next
Do not hardcode user-visible strings in pages/layouts. Use an i18n library integrated with App Router and load dictionaries on the server.
stack-nextjsstack-react+2
Low
Memoize components and callbacks when props are stable
For pure functions called repeatedly with the same inputs, memoize results; avoid recreating identical callbacks in hot paths.
performance-efficiencystack-react
Low
Model mutations with Server Actions when feasible
For simple form submissions from RSC, use server actions with schema validation and then revalidate paths/tags. Avoid client fetch for trivial mutations.
stack-nextjsstack-react+3
Low
Prefer next/link for internal navigation
Use <Link> from 'next/link' for internal routes; reserve <a> only for external URLs or downloadable assets.
stack-nextjsstack-react+2
Low
Provide loading.tsx and error.tsx per segment
For async routes, add loading.tsx for suspense fallbacks and error.tsx for boundaries. Use notFound() for 404 states.