Client Side Navigation (Single Page Apps)
What is Client Side Navigation?
Client-side navigation is a technique that allows users to move between pages without a full-page reload. Instead of the browser reloading the entire HTML document, the JavaScript runtime intercepts navigation events (like link clicks), fetches the next page’s content (usually as JavaScript modules or RSC payload), and updates the current view.
This approach is commonly referred to as a Single Page App (SPA). In RedwoodSDK, you get SPA-like navigation with server-fetched React Server Components (RSC), so it’s fast and dynamic, but still uses the server for rendering.
import { initClient, initClientNavigation } from "rwsdk/client";
initClient();initClientNavigation();
Once this is initialized, internal <a href="/some-path">
links will no longer trigger full-page reloads. Instead, the SDK will:
- Intercept the link click,
- Push the new URL to the browser’s history,
- Fetch the new page’s RSC payload from the server,
- And hydrate it on the client.
RedwoodSDK keeps everything minimal and transparent. No magic routing system. No nested router contexts. You get the benefits of a modern SPA without giving up control.
Transitions and View Animations
Client-side navigation enables you to animate between pages without jank. Pair it with View Transitions in React 19 to create seamless visual transitions.
Caveats
No routing system is included: RedwoodSDK doesn’t provide a client-side router. You can layer your own state management or page transitions as needed.
Only internal links are intercepted: RedwoodSDK will only handle links pointing to the same origin. External links (https://example.com) or those with target="\_blank"
behave normally.
Middleware still runs: Every navigation hits your server again — so auth checks, headers, and streaming behavior remain intact.