Skip to main content

Client RPC

Client-side utilities for calling server functions with streaming, abort signals, and custom fetch options.

useServerFn

React hook for calling server functions with loading states.

Custom Fetch Options

Pass custom fetch options when calling server functions.

Streaming Responses

Server functions support streaming responses for large datasets or real-time updates.

Server-Side Streaming

Client-Side Consumption

Error Handling

Handle errors from server functions on the client.

Request Deduplication

Multiple concurrent calls to the same server function are automatically deduplicated.

Custom Fetch

Provide a custom fetch implementation.

Serialization

Server functions automatically serialize and deserialize complex data types.

Supported Types

  • Primitives (string, number, boolean, null, undefined)
  • Objects and Arrays
  • Date objects
  • RegExp objects
  • Map and Set
  • Error objects
  • Custom serializable types

Example

Server Function Context

Access request context on the client.

Examples

Form Submission

Infinite Scroll

Real-time Updates

Optimistic Updates