Skip to content
Skills Library
Programming · Review & audit

react-best-practices

/react-best-practices

React component conventions for explicit state ownership and data flow. Use when creating or reviewing React components, hooks, effects, or forms.

Repository
skills ↗
Licence
MPL-2.0
Last repository change
27.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
23
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MPL-2.0, otwarta.

What it does and when to use it

React component conventions for explicit state ownership and data flow. Use when creating or reviewing React components, hooks, effects, or forms.

Original author description

React component conventions for explicit state ownership and data flow. Use when creating or reviewing React components, hooks, effects, or forms.

How it works

  1. Library Sources
  2. References
Original SKILL.md headings · 43 lines, 490 words
SKILL.md preview
---
name: react-best-practices
description: React component conventions for explicit state ownership and data flow. Use when creating or reviewing React components, hooks, effects, or forms.
---

# React Best Practices

> [!IMPORTANT]
> Apply the `architecture:code-style` principles to React: treat components as a declarative projection of owned state, derive what can be calculated, render every state explicitly, and isolate effects to synchronization with external systems so components remain predictable and easy to change.

## Library Sources

- GitHub repository ID: `react/react`
- Context7 library ID: `/websites/react_dev`
- DeepWiki repository ID: `react/react`

Use Context7 for current documentation and DeepWiki for implementation details.

## References

Read the references that apply to the current task before writing or reviewing React component, state, rendering, effect, data-loading, or form code.

1. Own mutable state narrowly and derive every value that its inputs already prove.
   - [Keep computable values out of state](./references/derive-values.md) so they cannot drift from their inputs.
   - [Place mutable state at the smallest shared owner](./references/scope-state.md), lifting it only for sibling consumers.
   - [Represent exclusive UI modes as one valid-state set](./references/state-machines.md), not contradictory flags.
   - [Use a functional state update for transitions derived from the same state](./references/functional-state-updates.md) so queued transitions compose and callbacks do not capture a render snapshot.
   - [Let changed domain identity create a new state lifetime through remounting](./references/reset-state-by-remounting.md), not field-by-field reset effects.
   - [Remove hidden UI through conditional mounting](./references/conditional-mounting.md) when it must discard local state, focus, or other child lifetime state.
2. Render explicit states and compose components around their owned contracts.
   - [Make JSX absence and branch conditions explicit](./references/explicit-rendering.md) rather than relying on truthiness.
   - [Establish context ownership](./references/context-ownership.md) only when one subsystem owns state or behavior consumed across multiple depths.
   - [Preserve the complete platform contract in native element props](./references/native-element-props.md) instead of maintaining an incomplete handwritten prop surface.
   - [Express passive layout content through children composition](./references/children-composition.md); reserve render callbacks for owner-provided behavior.
   - [Compose conditional classes at their styling owner](./references/class-composition.md) while preserving existing component and layout contracts.
3. Restrict effects and memoization to their actual ownership boundaries.
   - [Reserve effects for reactive external-system synchronization](./references/external-system-effects.md).
   - [Memoize every pure render-time computation worse than O(1)](./references/manual-memoization.md), including scalar and O(log n) work; keep O(1) derivations inline.
   - [Split independent caches with atomic memoization](./references/atomic-memoization.md) so unrelated inputs do not invalidate each other.
   - [Compute synchronized values during render instead of using derived-state effects](./references/avoid-derived-state-effects.md), preventing stale intermediate UI and a second writable source of truth.
   - [Keep event work in the handler that receives the action](./references/event-work.md) instead of routing it through state and an effect.
   - [Keep ordered work in one event, query, or server-operation owner](./references/avoid-effect-chains.md) to avoid effect chains that obscure sequencing and failures.
4. Treat form input and submission state as form-wide contracts.
   - [Use controlled state only for live rendered feedback and parse `FormData` in `onSubmit` for either input model](./references/form-validation.md), keeping submission independent of changing input state.
   - [Model pending, success, and failure as a form-wide operation](./references/submission-state.md), not as one button's state.
   - [Treat missing submitter identity as valid](./references/submitter-identity.md) unless distinct buttons select the operation; then validate it as form input instead of throwing or inventing a default.
Files in this package (23)
  • SKILL.md 4 KB
  • agents/openai.yaml 1 KB
  • assets/icon-light.svg 6 KB
  • references/atomic-memoization.md 1 KB
  • references/avoid-derived-state-effects.md 2 KB
  • references/avoid-effect-chains.md 1 KB
  • references/children-composition.md 1 KB
  • references/class-composition.md 1 KB
  • references/conditional-mounting.md 1 KB
  • references/context-ownership.md 1 KB
  • references/derive-values.md 1 KB
  • references/event-work.md 1 KB
  • references/explicit-rendering.md 1 KB
  • references/external-system-effects.md 3 KB
  • references/form-validation.md 3 KB
  • references/functional-state-updates.md 1 KB
  • references/manual-memoization.md 1 KB
  • references/native-element-props.md 1 KB
  • references/reset-state-by-remounting.md 1 KB
  • references/scope-state.md 1 KB
  • references/state-machines.md 2 KB
  • references/submission-state.md 2 KB
  • references/submitter-identity.md 1 KB

Versions

RepositoryScoreLicence
This page · bastidood/skills90MPL-2.0
acaprino/alfio-claude-plugins100MIT
acaprino/alfio-claude-plugins100MIT
acaprino/alfio-claude-plugins100MIT
acaprino/alfio-claude-plugins100MIT
acaprino/alfio-claude-plugins100MIT
akillness/jeo-skills100MIT
kamiazya/whiteboard100Apache-2.0
acaprino/alfio-claude-plugins100MIT

Database snapshot: 13.11.2026 · package version 5cac4f1a031b (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90tanstack-react-query-best-practices
    TanStack Query conventions for cache-backed React server state. Use when creating or reviewing React queries, mutations, query keys, or cache updates.
  • 100react-patterns
    React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management).
  • 100react-patterns
    React best practices covering functional components, hooks, state management, performance, and accessibility. Use when writing or reviewing React components, hooks, or state logic.
  • 95react-performance
    React/Next.js performance patterns with wrong/right code examples. Apply when building or reviewing React components. Adapted from Vercel React Best Practices by @shuding.
  • 90tanstack-react-table-best-practices
    TanStack Table v9 conventions for stable React table schemas and instance behavior. Use when creating or reviewing React tables, columns, metadata, or rendering.
  • 100react-conventions
    Standards for writing React code — props, JSX, component structure, effects. Use when writing or reviewing any component or hook, even if conventions aren't mentioned. Targets React 19.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.