Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

262
Visualizações
Any problem using localStorage instead of $page.params.id in Sveltekit?

In sveltekit, any problem using localStorage for passing along a post id from a list to a detail or edit page instead of using $page.params.id?

Instead of having a page "edit/[id].svelte" it will just be "edit.svelte".

Should be easy to understand without showing any code. I know it has been somewhat answered e g for react and perhaps the answer is the same but I only know svelte. Similar to this question: Using localstorage in React apps instead of useContext

Pros and cons? Any risk of it being slow to setItem before getItem in edit.svelte compared to using $page.params.id?

One advantage is VS Code, having a more practical and clear file structure. The thing that started me thinking about this. Instead of a directory with edit/[id].svelte it would just be edit.svelte.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Those are two very different things, if you have edit/[id].svelte you can have server side rendering, while if you rely on localStorage you can not do that at all.

I see no benefits to doing this at all, even think you are making your code unnecessary complicated.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda