Skip to main content
rule CX Codex

rendering-activity — Claude Code rule: what it does, how to install

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

no license ★ 1,064 updated 2026-01-21

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/rendering-activity.md
Open on GitHub

What rendering-activity 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.

What it helps with

  • 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 for the agent

  • 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.

How to install rendering-activity

Manually: put the files in place

.claude/rules/rendering-activity.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about rendering-activity

How do I install rendering-activity in Claude Code?

Copy the rule file into your project at .claude/rules/rendering-activity.md. That path is the whole install.

What does rendering-activity do?

It has the agent wrap expensive, frequently toggled React components in <Activity> and switch mode, so state and DOM are kept while the component is hidden.

Which components should use it?

Ones that cost a lot to render and are shown and hidden often, like a menu that opens and closes repeatedly.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set20

The whole set →
js-min-max-loop js-min-max-loop instructs the agent to pick minimum or maximum values with a single loop instead of sorting. Avoids O(n log n) sorting costs and unnecessary array copies. CX Codex +1 ★ 1,064repo stars interview interview runs a long question-and-answer session about a plan file and writes the finished spec back to the same path. CX Codex +1 ★ 1,064repo stars js-cache-property-access js-cache-property-access guides Claude Code to store deep object properties and array bounds in local variables before executing JavaScript loops. CX Codex +1 ★ 1,064repo stars js-set-map-lookups The js-set-map-lookups rule recommends using a Set when code repeatedly checks array membership. It applies to repeated lookups, such as filtering items by ID. CX Codex +1 ★ 1,064repo stars rendering-svg-precision rendering-svg-precision — a rule for Claude Code that reduces SVG coordinate precision to one decimal place. Applies when creating icons or editing graphics. CX Codex +1 ★ 1,064repo stars _template _template — a rule-file scaffold with fields for its title and impact, plus sections for contrasting incorrect and correct code. CX Codex +1 ★ 1,064repo stars async-parallel async-parallel — a Claude rule that sends independent async calls through Promise.all() instead of awaiting them one by one. Useful when a handler piles up sequential awaits. CX Codex +1 ★ 1,064repo stars rerender-derived-state The rerender-derived-state rule favors derived boolean state over continuously changing values, reducing React re-renders. It fits responsive UI logic. CX Codex +1 ★ 1,064repo stars

Project sponsors

Companies that keep this analytics open