Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!