11

Currently in having on:click | preventDefault="{() => showDetail({id})}" and in showDetail function i want to naviagte to particular id which in i am passing on click of button.

I tried regular javascript methodlocation.assign but this is reloading the page and destroying the purpose of SPA. Is there any way to navigate in svelte without reloading

Godric Gryffindor
  • 653
  • 1
  • 7
  • 10
  • 1
    Look here for a solution with SvelteKit: https://stackoverflow.com/questions/68187584/how-to-route-programmatically-in-sveltekit – Ulf Aslak Oct 18 '21 at 11:53

1 Answers1

4

You need a router. There are SPA routers (Single Page Application) and SSR router (Server Side Rendering).

You may try :

JeffProd
  • 3,088
  • 1
  • 19
  • 38