# react-state-minimize

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.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 88 repo stars
- Author: alexj11324
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/alexj11324/Mikka/tree/HEAD/.claude/skills/react-native-skills/rules/react-state-minimize.md
- Updated: 2026-11-17
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/react-state-minimize

## What it 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.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/react-state-minimize.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/react-state-minimize.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/react-state-minimize.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/react-state-minimize.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/react-state-minimize.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/alexj11324/Mikka/tree/HEAD/.claude/skills/react-native-skills/rules/react-state-minimize.md

## When to use it
- eliminate redundant `useState` variables in components
- remove sync logic inside `useEffect` hooks
- stop UI values from drifting out of sync
- cut down unnecessary React re-renders

## Example prompts
- 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

## Similar
- [state-ground-truth](https://affpapa.org/en/nevibecode/rules/state-ground-truth.md) — rule · ★ 1216 repo stars
- [react-state-dispatcher](https://affpapa.org/en/nevibecode/rules/react-state-dispatcher.md) — rule · ★ 1216 repo stars
- [react-state-management](https://affpapa.org/en/nevibecode/skills/react-state-management.md) — skill · 15286 installs
- [component-state-auditor](https://affpapa.org/en/nevibecode/skills/component-state-auditor.md) — skill · ★ 529 repo stars
- [zustand-state-management](https://affpapa.org/en/nevibecode/skills/zustand-state-management.md) — skill · 1000 installs
- [react-state-machine](https://affpapa.org/en/nevibecode/skills/react-state-machine.md) — skill · 201 installs

From the same set: [alexj11324/mikka](https://affpapa.org/en/nevibecode/by/alexj11324/mikka.md) — 47 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
