Slide 7
Slide 7 text
Routing has 4 major components…
● URL Mapping: In an SPA, certain URLs are associated with specific components or views
within the application. For example, /home, /about, /products, etc., might correspond to
different sections or pages of the SPA.
● Client-side Routing: When a user navigates to a specific URL within an SPA (e.g., by clicking
a link or typing in the address bar), the routing system intercepts this request on the client-
side, typically using JavaScript.
● Component Rendering: Based on the requested URL, the routing system determines which
component or view should be rendered within the SPA's main container or viewport. This could
involve showing or hiding different sections of the page, or dynamically loading content from
the server.
● History Management: SPAs use the browser's History API (e.g., pushState and replaceState)
to manage navigation history without triggering full page reloads. This allows users to use the
browser's back and forward buttons to navigate within the SPA.