rerender-transitions — Claude Code rule: UI updates, install
The rerender-transitions rule marks frequent, non-urgent state changes as transitions. It fits React code where updates such as scroll tracking should keep the interface responsive.
MIT ★ 7,191 updated 2026-10-24
.claude/rules/rerender-transitions.mdWhat rerender-transitions does
The rule targets frequent React state updates that do not need to interrupt the current interface. It recommends wrapping those changes in startTransition, giving the update non-urgent priority. Its example applies this pattern to a scroll position stored from a scroll event.
The file contains guidance and a code sample using useState, useEffect, startTransition, and a passive event listener. The listener is removed when the component unmounts. A scroll handler that calls the state setter directly can block the UI on every event, so this rule points to a specific review check.
What it helps with
- review state updates inside a scroll handler
- move non-urgent changes into
startTransition - check cleanup for the
scrolllistener - keep frequent UI updates from blocking rendering
Example prompts for the agent
- Review this React scroll handler and move its non-urgent state update into
startTransition. - Rewrite the component so frequent scroll updates do not block the interface.
- Check this component for state changes that should use a transition.
How to install rerender-transitions
Manually: put the files in place
.claude/rules/rerender-transitions.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/rerender-transitions.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/rerender-transitions.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/rerender-transitions.mdManually: put the files in place
.clinerules/rerender-transitions.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about rerender-transitions
How do I install rerender-transitions in Claude Code?
Copy the rule file to .claude/rules/rerender-transitions.md.
What does rerender-transitions do?
It guides Claude Code to treat frequent, non-urgent React state changes as transitions. The example uses this approach for scroll position updates.
Why does the rule use startTransition for scrolling?
A state update on every scroll event can block the UI. startTransition marks that update as non-urgent.
Source text
rerender-transitions.md · MIT
---
title: Use Transitions for Non-Urgent Updates
impact: MEDIUM
impactDescription: maintains UI responsiveness
tags: rerender, transitions, startTransition, performance
---
## Use Transitions for Non-Urgent Updates
Mark frequent, non-urgent state updates as transitions to maintain UI responsiveness.
**Incorrect (blocks UI on every scroll):**
```tsx
function ScrollTracker() {
const [scrollY, setScrollY] = useState(0)
useEffect(() => {
const handler = () => setScrollY(window.scrollY)
window.addEventListener('scroll', handler, { passive: true })
return () => window.removeEventListener('scroll', handler)
}, [])
}
```
**Correct (non-blocking updates):**
```tsx
import { startTransition } from 'react'
function ScrollTracker() {
const [scrollY, setScrollY] = useState(0)
useEffect(() => {
const handler = () => {
startTransition(() => setScrollY(window.scrollY))
}
window.addEventListener('scroll', handler, { passive: true })
return () => window.removeEventListener('scroll', handler)
}, [])
}
```
© tech-leads-club · MIT · tech-leads-club/agent-skills