Suppose a visitor lands on a server-rendered Next.js page while logged out. The server renders public content: no saved items yet, and a header asking them to sign in. Once they log in on the client, both the header and the saved state on the page need to update.
There are two main ways to handle this:
- Client-side
useEffectreload: Watch the auth token in React context and re-fetch just the header or saved-state data from the browser. It only reloads what you ask for, which is nice, but now you have to track when the token actually changed since SSR, write separate client fetchers, and test both server and client paths. - Router reload: Trigger a soft router reload (
router.reload(router.asPath)in Pages Router, orrouter.refresh()in App Router) so Next.js re-runs server data fetching and streams updated JSON props without a full browser page reload.
It is not targeted (it reloads all server data on the page), but it takes almost no code and keeps one data-fetching path on the server. Until you genuinely need targeted partial updates, the router reload is the simpler default.