react-state-minimize — Claude Code rule: what it does, how to install
react-state-minimize is a Claude Code rule that enforces minimal React state. It directs assistants to compute values on render rather than storing redundant state variables.
AGPL-3.0 ★ 88 updated 2026-11-17
.claude/rules/react-state-minimize.mdWhat react-state-minimize does
The rule instructs coding agents to treat state as a minimal single source of truth. Whenever data can be calculated from incoming props or existing variables, the model must calculate it directly inside the component body.
It flags patterns where developers sync dependent state via useEffect. Redundant fields trigger unnecessary component re-renders and cause state drift over time.
What it helps with
- eliminate redundant
useStatevariables in components - remove sync logic inside
useEffecthooks - stop UI values from drifting out of sync
- cut down unnecessary React re-renders
Example prompts for the agent
- Refactor this cart view using react-state-minimize to derive totals
- Check this form component for redundant state variables
- Clean up useEffect hooks that only calculate derived data
How to install react-state-minimize
Manually: put the files in place
.claude/rules/react-state-minimize.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/react-state-minimize.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/react-state-minimize.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/react-state-minimize.mdManually: put the files in place
.clinerules/react-state-minimize.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about react-state-minimize
How to install react-state-minimize in Claude Code?
Add the rule contents into .claude/rules/react-state-minimize.md inside your project directory.
What does react-state-minimize do?
It instructs coding agents to keep React state minimal and compute derived values during render instead of caching them in state.
Why does the rule discourage storing derived values in state?
Redundant state variables trigger extra re-renders and can easily drift out of sync with props.