1

I believe that SPA should save it's UI state to the URL - be it page navigation, search input or setting of filters. So that when I copy the URL and share it with someone else that person will see what I see.

What is the name of this concept?

3 Answers 3

2

I think the answer you're looking for is URL state synchronization or State Management (the latter contain the previous one). This is a quite important component of SPAs, as you already noticed.

I think the best way to explain it, other than the link above which has a very generic explanation, is to see examples from different sources and libraries:

1

Parameterization is the technical term if you mean the www.xyz.com?color=blue&material=suede&filter=shoes syntax

https://www.semrush.com/blog/url-parameters/

1

Probably you are referring to routing.

In an SPA it uses the Web’s History API, which allows to handle changes of the URL in JavaScript.

It basically consist of mapping URL paths to JavaScript modules that handle these virtual pages.

Here’s an example of how this is set up in Vue Router:

const router = new VueRouter({
  routes: [
    // dynamic segments start with a colon
    { path: '/user/:id', component: User }
  ]
})

and an article about Routing in Ember on MDN

Of course, there are routing libraries for all kinds of SPA Frameworks. React Router, Svelte Kit as a router, Vue Router, and of course Angular has Routing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.