API.md

@lazarv/react-server/remote

Loads a remote React component from another @lazarv/react-server deployment and renders it server-side, hydrating any client components via an import map.

const RemoteComponent: React.FC<{ src: string; ttl?: number; defer?: boolean; request?: RequestInit; onError?: (error: Error) => void; }>;

Loads a remote component from the given URL. The component is fetched and rendered on the server side and if contains any client components, they are hydrated on the client side. For client components to work properly, you might need to use an import map. If the component is streamed, use the defer option to re-fetch the component after the initial render on the client side.

Parameters

import RemoteComponent from '@lazarv/react-server/remote'; export default function App() { return ( <> <h1>App</h1> <RemoteComponent src="https://example.com/remote-component" /> </> ); }