Svelte · Senior · Question 47 of 75
How do you share state per request in a SvelteKit app safely?
- ✓Correct answer: Create it inside the component tree (e.g. in the root layout) and provide it via context; never in module-level variables on the server
- 2Use a global store exported from a module
- 3Use
globalThis
Explanation
Each server render gets its own component tree and context, so data doesn't leak between users.