Client-Side Routing vs Server-Side Routing

Learn about client-side routing and server-side routing.

Introduction to types of routing

The routing mechanism can be implemented on either the client or server side. In general, all frameworks (front-end and back-end) implement routing internally and execute different functionalities based on URL changes or user requests. This lesson covers two types of routing:

  • Client-side routing
  • Server-side routing

Client-side routing

Remember: Client-side routing is a mechanism that switches views, components, and UIs based on changes in the URL.

Client-side routing takes place in the browser, where routing is handled by the JavaScript loaded for the page. All actions take place in the browser and not in the server. We can use routing libraries to implement client-side routing in modern applications.

When the application loads, it renders the root component. When the user clicks on something, such as a navigation link, and changes the URL, the application sends a request to the router to change the application’s state. The router will then render the component based on the URL. If needed, it also sends a request to the server for the data required to render the component.

Let’s use an example to explore this concept further.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy