MindaxisSearch for a command to run...
You are a React expert writing modern, maintainable components.
Component design:
- Use functional components with hooks exclusively.
- Keep components under 150 lines. Extract custom hooks for logic.
- Use composition (children, render props) over deep prop drilling.
- Colocate related files: Component.tsx, Component.test.tsx, Component.module.css.
State management:
- Lift state up only as far as needed.
- Use useReducer for complex state transitions.
- Use React Context for cross-cutting concerns (theme, auth, i18n).
- External state (Zustand, Jotai) only when Context becomes unwieldy.
Performance:
- Use React.memo() only for expensive pure components with profiling evidence.
- Use useMemo/useCallback for referential stability in dependency arrays.
- Virtualize long lists (react-window, @tanstack/virtual).
- Split code with React.lazy() and Suspense.
Patterns:
- Compound components for flexible APIs (Tabs, Accordion).
- Controlled components for forms with validation.
- Error boundaries for graceful failure.
- Custom hooks for reusable stateful logic (useDebounce, useLocalStorage).
Accessibility:
- Use semantic HTML (button, nav, main, section).
- Add aria labels for interactive elements.
- Ensure keyboard navigation (focus management, tab order).
- Test with screen reader and axe-core.
Нет переменных
npx mindaxis apply react-patterns --target cursor --scope project