react-rendering-performance

react-rendering-performance is a cursor rule for Cursor from alonsarias/agent-rules. It costs 0 tokens per session (1,649 once invoked), scanned A, original, MIT.

A collection of React performance rules for reducing browser work while rendering interfaces. React is a JavaScript library for building user interfaces, and the rules cover animations, SVG graphics, long lists, visibility changes, and loading states.

In plain words
What is it for?
It helps optimize animated SVGs, long lists, show-and-hide controls, and loading screens in React applications. It also covers CSS techniques such as content visibility and React's transition-based loading states.
Why use it?
It helps avoid rendering patterns that make pages slower or cause unnecessary browser work. The guidance explains when to defer off-screen content or manage updates during loading.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It helps optimize animated SVGs, long lists, show-and-hide controls, and loading screens in React applications. It also covers CSS techniques such as content visibility and React's transition-based loading states.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/alonsarias/agent-rules/react-rendering-performance
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/alonsarias/agent-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react-rendering-performance

README.md
[![agentmods](https://agentmods.dev/badge/rules/alonsarias/agent-rules/react-rendering-performance/github.svg)](https://agentmods.dev/rules/alonsarias/agent-rules/react-rendering-performance)
Your own site
<a href="https://agentmods.dev/rules/alonsarias/agent-rules/react-rendering-performance"><img src="https://agentmods.dev/badge/rules/alonsarias/agent-rules/react-rendering-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for react-rendering-performance

Your own site · 80×15
<a href="https://agentmods.dev/rules/alonsarias/agent-rules/react-rendering-performance"><img src="https://agentmods.dev/badge/rules/alonsarias/agent-rules/react-rendering-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,649 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01649
Opus 5.5 $0.00000 $0.00660
Sonnet 5.5 $0.00000 $0.00330
Haiku 4.5 $0.00000 $0.00165

Measured 1mo ago against content hash d15ebacbc380, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

react-rendering-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/react-rendering-performance.mdc · 296 lines

How it starts

The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Rendering Performance

Patterns for optimizing the rendering process to reduce browser work.

1. Animate SVG Wrapper Instead of SVG Element

Impact: LOW - Enables hardware acceleration

Many browsers don't have hardware acceleration for CSS3 animations on SVG elements. Wrap SVG in a <div> and animate the wrapper.

Incorrect: animating SVG directly - no hardware acceleration

function LoadingSpinner() {
  return (
    <svg className="animate-spin" viewBox="0 0 24 24">
      <circle cx="12" cy="12" r="10" />
    </svg>
  )
}

Correct: animating wrapper div - hardware accelerated

function LoadingSpinner() {
  return (
    <div className="animate-spin">
      <svg viewBox="0 0 24 24">
        <circle cx="12" cy="12" r="10" />
      </svg>
    </div>
  )
}

This applies to all CSS transforms and transitions (transform, opacity, translate, scale, rotate).


2. CSS content-visibility for Long Lists

Impact: HIGH - Faster initial render

Apply content-visibility: auto to defer off-screen rendering.

CSS:

.message-item {
  content-visibility: auto;
  contain-intrinsic-size: 0 80px;
}

Usage:

function MessageList({ messages }: { messages: Message[] }) {
  return (
    <div className="message-list">
      {messages.map(msg => (
        <div key={msg.id} className="message-item">
          <MessageContent content={msg.content} />
        </div>
      ))}
    </div>
  )
}

For 1000 messages, browser skips layout/paint for ~990 off-screen items (10x faster initial render).


3. Hoist Static JSX Elements

Impact: LOW - Avoids re-creation

Extract static JSX outside components to avoid re-creation on every render.

Incorrect: recreates element every render

function LoadingSkeleton() {
  return <div className="skeleton animate-pulse" />
}

function Container() {
  return (
    <div>
      {loading && <LoadingSkeleton />}
    </div>
  )
}

Correct: reuses same element

Read the full file on GitHub · 296 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 296 lines · 0 tokens per session scan A d15ebacbc380

Subscribe to this mod's changes

react-rendering-performance is a cursor rule published in the GitHub repository alonsarias/agent-rules (4 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,649 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.