agentleFS
belos-streetbelos-street/grimoire/skills/react-best-practices/skill.md

react-best-practices

Skill8 starsChanged 3 months agoMITView on GitHub

MUST be used for React tasks. Strongly recommends functional components with Hooks and TypeScript as standard approach. Covers React 19, Next.js, SSR. Load for any React, .tsx files, React Router, Redux, or Vite with React work.

71 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use composition-patterns, python-best-practices and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • eeaSkill

    composition-patterns

    React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

    Also in 4 projects that use this

  • jefflesterSkill

    python-best-practices

    Python development best practices including PEP 8 style guidelines, type hints, docstring conventions, and common patterns. Use when writing or modifying Python code.

    Also in 3 projects that use this

  • MicrosoftSkill

    planning-with-files

    **USE THIS FOR COMPLEX TASKS.** Implements Manus-style file-based planning for multi-step tasks. Creates task_plan.md, findings.md, and progress.md in .agent_cache/<task-name>/. Use when: implementing multiple APIs, refactoring modules, research tasks, or ANY task requiring >5 tool calls.

    Also in 5 projects that use this

  • VercelSkill

    vercel-deploy

    Deploy applications and websites to Vercel with a claimable preview. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment". No authentication required - returns preview URL and claimable deployment link.

    Also in 3 projects that use this

  • MicrosoftSkill

    code-quality

    Statically check changed C# against the same deterministic rules github-code-quality[bot] runs on pull requests, so a contributor can fix likely findings before opening the PR and keep the bot's inline comments to a minimum. Activate when a contributor asks to "check code quality", "run code quality on my changes", "will the code quality bot complain", "pre-check before I open the PR", "code quality check", or similar. Scoped to C#. Reads the diff and compares it against the enumerated csharp-code-quality rule set below — no CodeQL download or build required. This is a fast approximation of a dataflow engine, not a reproduction; report accordingly. Does NOT apply fixes unless explicitly asked.

    Also in 5 projects that use this

  • JetBrainsSkill

    webapp-testing

    Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

    Also in 8 projects that use this

The file

Files
skill.md

React 19 best practices, common gotchas, and performance optimization.

State & Hooks

  • Multiple setState calls not batching as expected → See hooks-state-update-batching
  • Reading state immediately after setState → See hooks-async-state-updates
  • New state depends on previous state → See hooks-functional-updates
  • Expensive initial state running on every render → See hooks-initial-state-lazy
  • Mutating state directly causing bugs → See hooks-state-not-mutated-directly
  • Updating object state losing other properties → See hooks-object-state-spread

useEffect

  • Effect runs only once on mount → See useeffect-empty-deps
  • Missing dependencies causing stale closures → See useeffect-missing-dependencies
  • Forgetting to cleanup side effects → See useeffect-cleanup-function
  • Using async function as effect → See useeffect-async-pattern
  • Conditional useEffect calls causing errors → See useeffect-conditional-effects
  • Choosing between useEffect and useLayoutEffect → See useeffect-vs-uselayouteffect

Performance

  • Using useMemo unnecessarily → See usememo-unnecessary-optimization
  • Object references changing causing re-renders → See usememo-object-stability
  • useCallback dependency array issues → See usecallback-dependency-array
  • Using useCallback instead of inline functions → See usecallback-vs-inline-functions

Components

  • Mutating props directly → See component-props-immutable
  • Passing content to components → See component-children-prop
  • Component naming conventions → See component-naming-convention
  • Setting default prop values → See component-default-props
  • Prop type validation → See component-prop-types

Context

  • Avoiding prop drilling → See context-avoid-prop-drilling
  • Optimizing context performance → See context-performance-optimization
  • Providing default values → See context-default-values
  • Using multiple contexts → See context-multiple-contexts

Custom Hooks

  • Naming convention → See custom-hooks-naming-convention
  • Composing hooks together → See custom-hooks-composition
  • Cleaning up side effects → See custom-hooks-side-effects
  • Returning read-only state → See custom-hooks-readonly-state
  • Hooks vs utility functions → See custom-hooks-vs-utility-functions

Refs

  • useRef vs useState → See useRef-vs-state
  • Accessing DOM elements → See useRef-dom-access
  • Forwarding refs → See useRef-forward-ref
  • Cleaning up refs → See useRef-cleanup
  • Persisting values → See useRef-persistence

Event Handlers

  • Naming convention → See event-handlers-naming-convention
  • Avoiding inline handlers → See event-handlers-inline
  • Binding handlers properly → See event-handlers-binding
  • Controlling event propagation → See event-handlers-propagation
  • Cleaning up event listeners → See event-handlers-cleanup

Performance

  • Using React.memo → See performance-memo
  • Using useCallback → See performance-usecallback
  • Using useMemo → See performance-usememo
  • Code splitting → See performance-code-splitting
  • Virtualization → See performance-virtualization

Suspense

  • Lazy loading → See suspense-lazy-loading
  • Data fetching → See suspense-data-fetching
  • Error boundaries → See suspense-error-boundaries
  • Fallback UI → See suspense-fallback
  • Concurrent features → See suspense-concurrent-features

TypeScript

  • Component props typing → See typescript-component-props
  • Hooks typing → See typescript-hooks
  • Generics in React → See typescript-generics
  • Utility types → See typescript-utility-types
  • Best practices → See typescript-best-practices

Animation

  • CSS transitions → See animation-css-transitions
  • CSS animations → See animation-css-animations
  • Framer Motion → See animation-framer-motion
  • Performance optimization → See animation-performance
  • Best practices → See animation-best-practices

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.