⚛️ React.js Intermediate

What is the difference between client-side routing and server-side routing?

Why Interviewers Ask This

This tests whether you can apply React.js knowledge to real-world scenarios. Interviewers are looking for clarity of thought and evidence that you've encountered this in production code.

Answer

In server-side routing (traditional), navigating to a URL sends an HTTP request to the server, which responds with a full new HTML page — a full page reload occurs. Each navigation is a round trip to the server. Fast initial load, simple server setup, but slow navigation and full page reloads lose client state. In client-side routing (SPA), navigation is handled by JavaScript in the browser — React Router intercepts link clicks, pushes the URL to the browser's History API, and renders the appropriate component without a page reload. Only data changes (via API calls), not the entire page. Benefits: instantaneous navigation (no network round trip), smooth transitions, preserved state, offline-capable. React Router: uses the HTML5 History API to update the URL and render the matching component. Deep linking still works because the server must serve the same HTML for all routes (configure the server to return index.html for all paths). Next.js/Remix: combine both — initial page load is server-rendered for fast FCP and SEO, subsequent navigations are client-side for speed. This is the modern best practice.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last React.js project, I used this when...' immediately makes your answer more credible and memorable.