Send only rendered fields

Pass client components only what they render; sort on the client.

From vercel-react-best-practices: server-serialization and server-dedup-props.

50 fields sent, 1 rendered

Toggle fields and profiles, then compare payload bytes.

Profile renders
Whole objectBad
    –
    
            
    <Profile user={u} />
    Only rendered fieldsGood
      –
      
              
      <Profile name={u.name} />
      const user = await fetchUser()
      return <Profile name={user.name} />

      Server sorting sends it twice

      Type names, then switch between strings and objects.

      Sorted on the serverBad
        
                
        Sorted on the clientGood
          
                  
          <UserList usernames={usernames} />
          
          'use client'
          const ordered = useMemo(() => usernames.toSorted(), [usernames])

          Which operations break dedup?

          Pick a second prop, guess, then read the payload.

          Reference quiz0 / 0
          Second prop
          Is b sent again?

          
                    
          <C users={users} active={users.filter((u) => u.active)} />
          <C users={users} />

          Why it matters, pros and cons

          Why it matters

          Every prop sent to the client is serialized. A server .toSorted() sends a copy.

          Pros

          • Smaller HTML and RSC payload.
          • Server-only fields never reach page source.
          • Props state exactly what renders.

          Cons

          • Expensive transform: send only the derived result.
          • object[] repeats only the array shell. Low impact.
          • Many narrow props get verbose; a picked object is fine.