# Send React Performance to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "react-performance",
    "name": "React Performance",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/wpank/react-performance",
    "canonicalUrl": "https://clawhub.ai/wpank/react-performance",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/react-performance",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=react-performance",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "references/bundle-optimization.md",
      "references/async-patterns.md",
      "references/rerender-optimization.md",
      "references/server-components.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "react-performance",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T23:12:11.154Z",
      "expiresAt": "2026-05-14T23:12:11.154Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=react-performance",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=react-performance",
        "contentDisposition": "attachment; filename=\"react-performance-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "react-performance"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/react-performance"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/react-performance",
    "downloadUrl": "https://openagent3.xyz/downloads/react-performance",
    "agentUrl": "https://openagent3.xyz/skills/react-performance/agent",
    "manifestUrl": "https://openagent3.xyz/skills/react-performance/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/react-performance/agent.md"
  }
}
```
## Documentation

### React Performance Patterns

Performance optimization guide for React and Next.js applications. Patterns
across 7 categories, prioritized by impact. Detailed examples in references/.

### When to Apply

Writing new React components or Next.js pages
Implementing data fetching (client or server-side)
Reviewing or refactoring for performance
Optimizing bundle size or load times

### Categories by Priority

#CategoryImpact1Async / WaterfallsCRITICAL2Bundle SizeCRITICAL3Server ComponentsHIGH4Re-rendersMEDIUM5RenderingMEDIUM6Client-Side DataMEDIUM7JS PerformanceLOW-MEDIUM

### OpenClaw / Moltbot / Clawbot

npx clawhub@latest install react-performance

### Parallelize independent operations

Sequential awaits are the single biggest performance mistake in React apps.

// BAD — sequential, 3 round trips
const user = await fetchUser()
const posts = await fetchPosts()
const comments = await fetchComments()

// GOOD — parallel, 1 round trip
const [user, posts, comments] = await Promise.all([
  fetchUser(), fetchPosts(), fetchComments(),
])

### Defer await until needed

Move await into branches where the value is actually used.

// BAD — blocks both branches
async function handle(userId: string, skip: boolean) {
  const data = await fetchUserData(userId)
  if (skip) return { skipped: true }    // Still waited
  return process(data)
}

// GOOD — only blocks when needed
async function handle(userId: string, skip: boolean) {
  if (skip) return { skipped: true }    // Returns immediately
  return process(await fetchUserData(userId))
}

### Strategic Suspense boundaries

Show layout immediately while data-dependent sections load independently.

// BAD — entire page blocked
async function Page() {
  const data = await fetchData()
  return <div><Sidebar /><Header /><DataDisplay data={data} /><Footer /></div>
}

// GOOD — layout renders immediately, data streams in
function Page() {
  return (
    <div>
      <Sidebar /><Header />
      <Suspense fallback={<Skeleton />}><DataDisplay /></Suspense>
      <Footer />
    </div>
  )
}
async function DataDisplay() {
  const data = await fetchData()
  return <div>{data.content}</div>
}

Share a promise across components with use() to avoid duplicate fetches.

### Avoid barrel file imports

Barrel files load thousands of unused modules. Direct imports save 200-800ms.

// BAD — loads 1,583 modules
import { Check, X, Menu } from 'lucide-react'

// GOOD — loads only 3 modules
import Check from 'lucide-react/dist/esm/icons/check'
import X from 'lucide-react/dist/esm/icons/x'
import Menu from 'lucide-react/dist/esm/icons/menu'

Next.js 13.5+: use experimental.optimizePackageImports in config.
Commonly affected: lucide-react, @mui/material, react-icons, @radix-ui,
lodash, date-fns.

### Dynamic imports for heavy components

import dynamic from 'next/dynamic'
const MonacoEditor = dynamic(
  () => import('./monaco-editor').then((m) => m.MonacoEditor),
  { ssr: false }
)

### Defer non-critical third-party libraries

Analytics, logging, error tracking — load after hydration with dynamic() and
{ ssr: false }.

### Preload on user intent

const preload = () => { void import('./monaco-editor') }
<button onMouseEnter={preload} onFocus={preload} onClick={onClick}>Open Editor</button>

### Minimize serialization at RSC boundaries

Only pass fields the client actually uses across the server/client boundary.

// BAD — serializes all 50 user fields
return <Profile user={user} />

// GOOD — serializes 1 field
return <Profile name={user.name} />

### Parallel data fetching with composition

RSC execute sequentially within a tree. Restructure to parallelize.

// BAD — Sidebar waits for header fetch
export default async function Page() {
  const header = await fetchHeader()
  return <div><div>{header}</div><Sidebar /></div>
}

// GOOD — sibling async components fetch simultaneously
async function Header() { return <div>{await fetchHeader()}</div> }
async function Sidebar() { return <nav>{(await fetchSidebarItems()).map(renderItem)}</nav> }
export default function Page() { return <div><Header /><Sidebar /></div> }

### React.cache() for per-request deduplication

import { cache } from 'react'
export const getCurrentUser = cache(async () => {
  const session = await auth()
  if (!session?.user?.id) return null
  return await db.user.findUnique({ where: { id: session.user.id } })
})

Use primitive args (not inline objects) — React.cache() uses Object.is.
Next.js auto-deduplicates fetch, but React.cache() is needed for DB queries,
auth checks, and computations.

### after() for non-blocking operations

import { after } from 'next/server'
export async function POST(request: Request) {
  await updateDatabase(request)
  after(async () => { logUserAction({ userAgent: request.headers.get('user-agent') }) })
  return Response.json({ status: 'success' })
}

### Derive state during render — not in effects

// BAD — redundant state + effect
const [fullName, setFullName] = useState('')
useEffect(() => { setFullName(first + ' ' + last) }, [first, last])

// GOOD — derive inline
const fullName = first + ' ' + last

### Functional setState for stable callbacks

// BAD — recreated on every items change
const addItem = useCallback((item: Item) => {
  setItems([...items, item])
}, [items])

// GOOD — stable, always latest state
const addItem = useCallback((item: Item) => {
  setItems((curr) => [...curr, item])
}, [])

### Defer state reads to usage point

Don't subscribe to dynamic state if you only read it in callbacks.

// BAD — re-renders on every searchParams change
const searchParams = useSearchParams()
const handleShare = () => shareChat(chatId, { ref: searchParams.get('ref') })

// GOOD — reads on demand
const handleShare = () => {
  const ref = new URLSearchParams(window.location.search).get('ref')
  shareChat(chatId, { ref })
}

### Lazy state initialization

// BAD — JSON.parse runs every render
const [settings] = useState(JSON.parse(localStorage.getItem('s') || '{}'))

// GOOD — runs only once
const [settings] = useState(() => JSON.parse(localStorage.getItem('s') || '{}'))

### Subscribe to derived booleans

// BAD — re-renders on every pixel
const width = useWindowWidth(); const isMobile = width < 768

// GOOD — re-renders only when boolean flips
const isMobile = useMediaQuery('(max-width: 767px)')

### Transitions for non-urgent updates

// BAD — blocks UI on scroll
const handler = () => setScrollY(window.scrollY)

// GOOD — non-blocking
const handler = () => startTransition(() => setScrollY(window.scrollY))

### Extract expensive work into memoized components

const UserAvatar = memo(function UserAvatar({ user }: { user: User }) {
  const id = useMemo(() => computeAvatarId(user), [user])
  return <Avatar id={id} />
})
function Profile({ user, loading }: Props) {
  if (loading) return <Skeleton />
  return <div><UserAvatar user={user} /></div>
}

Note: React Compiler makes manual memo()/useMemo() unnecessary.

### CSS content-visibility for long lists

For 1000 items, browser skips ~990 off-screen (10x faster initial render).

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

### Hoist static JSX outside components

Avoids re-creation, especially for large SVG nodes. React Compiler does this
automatically.

const skeleton = <div className="skeleton" />
function Container() { return <div>{loading && skeleton}</div> }

### SWR for deduplication and caching

// BAD — each instance fetches independently
useEffect(() => { fetch('/api/users').then(r => r.json()).then(setUsers) }, [])

// GOOD — multiple instances share one request
const { data: users } = useSWR('/api/users', fetcher)

### Set/Map for O(1) lookups

// BAD — O(n)
items.filter(i => allowed.includes(i.id))
// GOOD — O(1)
const allowedSet = new Set(allowed)
items.filter(i => allowedSet.has(i.id))

### Combine array iterations

// BAD — 3 passes
const a = users.filter(u => u.isAdmin)
const t = users.filter(u => u.isTester)
// GOOD — 1 pass
const a: User[] = [], t: User[] = []
for (const u of users) { if (u.isAdmin) a.push(u); if (u.isTester) t.push(u) }

Also: early returns, cache property access in loops, hoist RegExp outside
loops, prefer for...of for hot paths.

### Quick Decision Guide

Slow page load? → Bundle size (2), then async waterfalls (1)
Sluggish interactions? → Re-renders (4), then JS perf (7)
Server page slow? → RSC serialization & parallel fetching (3)
Client data stale/slow? → SWR (6)
Long lists janky? → content-visibility (5)
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: wpank
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-07T23:12:11.154Z
- Expires at: 2026-05-14T23:12:11.154Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/react-performance)
- [Send to Agent page](https://openagent3.xyz/skills/react-performance/agent)
- [JSON manifest](https://openagent3.xyz/skills/react-performance/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/react-performance/agent.md)
- [Download page](https://openagent3.xyz/downloads/react-performance)