Course contentsShow
← React
Lesson 1587 of 2,39639. Server Components in PracticeFree lesson

What Can Cross the Server-Client Boundary

Only serializable data (strings, numbers, dates, plain objects, arrays) can pass from server to client components.

What Can Cross the Server-Client Boundary

You'll learn what types of data can safely travel from server components to client components—and what can't.

The Serialization Rule

When server components pass data to client components, React must serialize that data—convert it into a format that can be transmitted over the network. Think of it like packing a suitcase: you can only bring items that fit and survive the journey.

What can cross the boundary:

  • Strings: "hello"
  • Numbers: 42, 3.14
  • Booleans: true, false
  • Dates: new Date()
  • Plain objects: { name: "Alice", age: 30 }
  • Arrays: [1, 2, 3]
  • null and undefined

What cannot cross:

  • Functions (including event handlers)
  • Class instances (custom objects with methods)
  • Symbols
  • Anything with circular references

Why This Matters

Imagine a server component fetching user data:

// Server Component
async function UserProfile() {
  const user = await db.query('SELECT * FROM users');
  // ✅ This works - plain object with strings/numbers
  return <ClientCard user={user} />;
}

But you can't pass functions or class instances:

// ❌ Won't work
const userWithMethod = {
  name: "Alice",
  greet: () => console.log("Hi") // Functions can't serialize
};

Think of the boundary like international mail: you can send letters and photos, but not a living plant or a phone call.

Key Takeaway: Only serializable data (strings, numbers, dates, plain objects, arrays) can pass from server to client components—functions and class instances must stay on their respective sides of the boundary.