SPA patterns

Rendering components only in the browser

These examples skip prerendering for a component that needs browser APIs.

Using next/dynamic

Loading the component with ssr: false keeps it out of the server render.

Loading (browser only)…

Using React's browser()

Calling use(browser()) leaves this fallback in the prerendered HTML, then shows an editor backed by localStorage in the browser.

Loading saved draft…