|
|
|
|
|
by fatih-erikli
1492 days ago
|
|
I use it like that and I am pretty happy with it. There's one thing, you should redirect all the pages to one single endpoint in server side order to use "pushState". Otherwise it will return 404 when you hit the refresh button. If you don't own a server, you can support routing with hashtag "#" and listen to "onhashchange" event instead of "popstate". Also, if you would like to support nested and dynamic routes (it's not possible with that code snippet in the github repository since it just checks like `path===currentPath`), you might look at the following solution: https://github.com/fatih-erikli/universal-router/blob/main/u... I use that solution in server-side and client-side so it works like Nextjs. |
|