Checklist for creating and reviewing React components in VerifyWise.
- Component uses function declaration (not arrow function export)
- Imports are organized (external → internal → types)
- Props interface is defined
- Component is exported as named export
- File name matches component name (PascalCase)
-
useStatedeclarations first -
useContextafter useState -
useRefafter context - Custom hooks next
-
useMemofor derived values -
useCallbackfor event handlers -
useEffectlast
- Props interface is properly typed
- Required props don't have
? - Optional props have
?and defaults - Callback props use
onActionnaming (onClick, onChange) - Boolean props use
is/has/can/shouldprefix
- Default values provided for optional props
- Defaults are defined in destructuring or defaultProps
- State is minimal (no duplicate state)
- State is colocated (close to where it's used)
- Derived state uses
useMemo, not separate state
-
useEffecthas proper dependencies - Cleanup functions provided where needed
- Async operations handle component unmount
- Loading states handled
- Error states handled
- Empty states handled
- Early returns for invalid props
- Unique
keyprop for list items - Keys are stable (not index unless list is static)
- Empty list has fallback UI
- Colors from theme palette (
color="primary") - Spacing from theme (
p={2},m={3}) - Typography uses variants (
variant="body1") - No hardcoded pixel values for spacing
- No hardcoded colors
- Component works on mobile
- Uses responsive sx values or useMediaQuery
- Touch targets are adequate size (44px min)
- Interactive elements have accessible names
- Images have alt text
- Form inputs have labels
- Color is not sole means of conveying info
- All interactive elements are focusable
- Focus order is logical
- Custom controls have keyboard support
- ARIA labels where needed
- Live regions for dynamic content
- Headings have proper hierarchy
-
memo()used for expensive components -
useMemofor expensive calculations -
useCallbackfor callbacks passed to children - No inline objects/arrays in render (cause re-renders)
- Uses React Query for server state
- Loading states prevent redundant fetches
- Pagination for large lists
- Renders without crashing
- User interactions work
- Loading states render
- Error states render
- Accessibility tested
- Uses accessible queries (getByRole)
- Tests behavior, not implementation
- Edge cases covered
ComponentName: UserCard
✅ Structure
✅ Function declaration
✅ Imports organized
✅ Props typed
✅ Named export
✅ Props
✅ Interface defined
✅ Defaults provided
✅ State
✅ Minimal state
✅ Effects have cleanup
✅ Rendering
✅ Loading handled
✅ Error handled
✅ Empty handled
✅ Styling
✅ Theme colors
✅ Theme spacing
✅ Responsive
✅ Accessibility
✅ Labels present
✅ Keyboard works
✅ Performance
✅ Memoized appropriately
✅ Tests
✅ Tests exist
✅ Key behaviors covered
interface ComponentProps {
// Required
id: string;
// Optional with default
variant?: 'primary' | 'secondary';
// Callback
onClick?: () => void;
// Children
children?: React.ReactNode;
}export function Component({
id,
variant = 'primary',
onClick,
children,
}: ComponentProps) {
// hooks
// early returns
return (
// JSX
);
}