0

React Best Practices

Apply React best practices when working with React components and hooks

Instructions · تعليماتreact

Works with

windsurf (native)

Content

React Best Practices

Description

Apply React best practices when working with React components and hooks.

When working with React code, follow these practices:

  • Use functional components with hooks instead of class components
  • Implement proper dependency arrays in useEffect hooks
  • Use React.memo() for performance optimization when appropriate
  • Follow the Rules of Hooks (only call hooks at the top level)
  • Use custom hooks to extract and reuse stateful logic
  • Implement proper error boundaries for error handling
  • Use TypeScript with React for better type safety
  • Follow component composition patterns over inheritance

Source and license

Source
Windsurf Cascade Customizations Catalog
Original
Windsurf-Samples/cascade-customizations-catalog/customizations/rules/framework/react.md
License
MIT