# rendering-activity

rendering-activity — a Claude rule that tells the agent to keep costly React components inside <Activity> so hiding them does not throw away state.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 1064 repo stars
- Author: jarrodwatts
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/jarrodwatts/claude-code-config/tree/HEAD/skills/vercel-react-best-practices/rules/rendering-activity.md
- Updated: 2026-01-21
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/rendering-activity

## What it does

The rule is a single markdown file with one instruction: take a component that is expensive to render and gets shown and hidden all the time, wrap it in React's `<Activity>`, and drive the `mode` prop between `visible` and `hidden`. The tree stays put, so DOM and state survive each toggle.

A dropdown that picks its mode from an `isOpen` flag is the example given. The rule itself is marked MEDIUM, which reads as a local fix for one heavy component rather than a house style for every conditional render.

This only applies to a React project. `<Activity>` comes from React, and there is nothing to wrap anywhere else.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/rendering-activity.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/rendering-activity.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

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

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/rendering-activity.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/rendering-activity.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/jarrodwatts/claude-code-config/tree/HEAD/skills/vercel-react-best-practices/rules/rendering-activity.md

## When to use it
- stop a frequently toggled menu from losing its state
- keep a costly component's DOM alive between showings
- drop redundant re-renders when visibility flips
- point the agent at `<Activity>` instead of plain conditional rendering

## Example prompts
- Wrap `ExpensiveMenu` in `<Activity>` and drive `mode` from `isOpen` so it keeps its state.
- Which components here toggle visibility often enough to move them under `<Activity>`?
- Rewrite the dropdown's conditional render with `<Activity>` and keep the DOM mounted.

## Similar
- [rendering-no-falsy-and](https://affpapa.org/en/nevibecode/rules/rendering-no-falsy-and.md) — rule · ★ 88 repo stars
- [pixijs-rendering](https://affpapa.org/en/nevibecode/skills/pixijs-rendering.md) — skill · 10800 installs
- [rendering-animate-svg-wrapper](https://affpapa.org/en/nevibecode/rules/rendering-animate-svg-wrapper.md) — rule · ★ 7191 repo stars
- [rendering-text-in-text-component](https://affpapa.org/en/nevibecode/rules/rendering-text-in-text-component.md) — rule · ★ 88 repo stars
- [scenario-blender-lighting-rendering](https://affpapa.org/en/nevibecode/skills/scenario-blender-lighting-rendering.md) — skill · 1100 installs
- [scenario-godot-rendering-lighting](https://affpapa.org/en/nevibecode/skills/scenario-godot-rendering-lighting.md) — skill · 449 installs

From the same set: [jarrodwatts/claude-code-config](https://affpapa.org/en/nevibecode/by/jarrodwatts/claude-code-config.md) — 20 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
