Skip to main content
rule CX Codex

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

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

What 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 scroll listener
  • 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.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 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

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set130

The whole set →
server-serialization server-serialization is a Claude Code rule for limiting data passed across React Server/Client boundaries. It applies when client components receive props from server components. CX Codex +1 ★ 7,191repo stars rerender-simple-expression-in-memo The rerender-simple-expression-in-memo rule advises against using useMemo for simple expressions that return a boolean, number, or string. It applies when reviewing React component calculations. CX Codex +1 ★ 7,191repo stars js-hoist-regexp js-hoist-regexp — a Claude rule that keeps RegExp construction out of the render path: define the pattern at module scope or wrap it in useMemo(). CX Codex +1 ★ 7,191repo stars rendering-hoist-jsx rendering-hoist-jsx extracts static JSX elements outside components to prevent element re-creation on every render pass. CX Codex +1 ★ 7,191repo stars advanced-use-latest advanced-use-latest — a Claude rule file on reaching fresh callback values inside a React effect and keeping the dependency array down to state. CX Codex +1 ★ 7,191repo stars async-api-routes async-api-routes prevents sequential waterfall requests in API routes and Server Actions. It instructs the assistant to launch independent promises immediately rather than chaining awaits. CX Codex +1 ★ 7,191repo stars js-early-exit The js-early-exit rule recommends returning as soon as a function’s result is clear. It fits checks where continuing after the first error serves no purpose. CX Codex +1 ★ 7,191repo stars rerender-memo rerender-memo — a rule that guides your agent to extract expensive computations into memoized components, enabling early returns without triggering child logic. Speeds up React re-render paths. CX Codex +1 ★ 7,191repo stars

Project sponsors

Companies that keep this analytics open