Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/server-serialization.md
1---2title: Minimize Serialization at RSC Boundaries3impact: HIGH4impactDescription: reduces data transfer size5tags: server, rsc, serialization, props6---78## Minimize Serialization at RSC Boundaries910The React Server/Client boundary serializes all object properties into strings and embeds them in the HTML response and subsequent RSC requests. This serialized data directly impacts page weight and load time, so **size matters a lot**. Only pass fields that the client actually uses.1112**Incorrect (serializes all 50 fields):**1314```tsx15async function Page() {16const user = await fetchUser() // 50 fields17return <Profile user={user} />18}1920'use client'21function Profile({ user }: { user: User }) {22return <div>{user.name}</div> // uses 1 field23}24```2526**Correct (serializes only 1 field):**2728```tsx29async function Page() {30const user = await fetchUser()31return <Profile name={user.name} />32}3334'use client'35function Profile({ name }: { name: string }) {36return <div>{name}</div>37}38```39