Svelte Senior interview questions and answers
75 questions for a Svelte (Senior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.What model does Svelte 5 reactivity use under the hood?
- 2.Why did Svelte 5 move from compiler-instrumented
letreactivity to runes? - 3.How are
$derivedvalues evaluated? - 4.Why does this effect run only once, even though
state.valuechanges? - 5.What does it mean that
$effectdependencies are dynamic? - 6.What happens with updates batched in Svelte 5?
- 7.What is the cost of deep
$stateproxies, and how do you control it? - 8.What does
createSubscriberfromsvelte/reactivitysolve? - 9.What does
$effect.tracking()return? - 10.Why must
$effectbe created inside a component or another effect, and what is$effect.rootfor? - 11.How does Svelte 5 handle events like
clickandinputfor performance? - 12.Why is a
{#key}block an expensive way to re-run child logic? - 13.What does experimental async Svelte (5.36+) allow?
- 14.What are "synchronized updates" in async Svelte?
- 15.Do independent
awaitexpressions in markup run sequentially? - 16.How do you show a loading state with async Svelte?
- 17.Which errors does
<svelte:boundary>NOT catch? - 18.What does
$state.eagerdo in async Svelte? - 19.How does Svelte render on the server?
- 20.Why can
MediaQueryor readinglocalStorageat component init cause problems with SSR? - 21.Why is
<svelte:head>content important for SvelteKit SEO? - 22.When does SvelteKit re-run a
loadfunction? - 23.Why is an auth check only in
+layout.server.jsrisky? - 24.How do you trigger a reload of specific data after a mutation?
- 25.Why should
loadfunctions be free of side effects? - 26.What does
event.localsgive you in SvelteKit? - 27.What is
handleFetchused for? - 28.What does the
reroutehook do? - 29.What does
handleErrordo, and why shouldn't it expose details? - 30.What does the
transporthook allow? - 31.What are SvelteKit remote functions?
- 32.How do the remote function types differ?
- 33.What is a single-flight mutation in remote functions?
- 34.Why should remote function arguments be validated?
- 35.How does SvelteKit protect form actions from CSRF?
- 36.How do you prerender dynamic routes like
/blog/[slug]? - 37.What is the trade-off of making a SvelteKit app an SPA with a fallback page?
- 38.Why are form actions a good default for mutations in SvelteKit?
- 39.What is
page.form/ theformprop after an action? - 40.How does
use:enhancecustomization work? - 41.Where is SvelteKit configuration declared in SvelteKit 3?
- 42.What replaced
$app/storesin SvelteKit? - 43.What happened to the
$libalias in SvelteKit 3? - 44.How do you migrate a project to SvelteKit 3 or a codebase to Svelte 5 syntax?
- 45.How can you migrate a large Svelte 4 app to Svelte 5 gradually?
- 46.Where should private environment variables be read in SvelteKit 3?
- 47.How do you share state per request in a SvelteKit app safely?
- 48.Why does SvelteKit keep page components mounted when navigating between
/blog/aand/blog/b? - 49.Where should UI state like filters or the current tab live if it must survive reloads and be shareable?
- 50.What is the main performance advice for data loading in SvelteKit?
- 51.How can you make a code-heavy component load only when needed?
- 52.What should you consider when designing a Svelte component library?
- 53.How does scoping CSS work, and what are its limits?
- 54.What does
<svelte:options customElement>change about styling and props? - 55.Why test runes logic in files named
*.svelte.test.js? - 56.Which approach fits end-to-end testing of a SvelteKit app?
- 57.What is a good way to debug unexpected re-runs in Svelte 5?
- 58.What is wrong with deriving state from props like this in a reusable component?
- 59.How do you type a component that accepts a generic list and a row snippet?
- 60.What is the difference between
mountandhydrate? - 61.Why would you return a promise from a server
loadinstead of awaiting everything? - 62.What does
updatedfrom$app/statehelp with? - 63.When is Svelte a particularly good fit compared to larger frameworks?
- 64.What does
fromActionfromsvelte/attachmentsdo? - 65.Why is mutating
datareceived fromloadin a page component a bad idea? - 66.What does event delegation in Svelte 5 mean for listeners added with
addEventListeneronwindow? - 67.Why can't a
$derivedexpression change state? - 68.What does
$effect.pending()return in async Svelte? - 69.What is a risk of using
$statein a class field that is exposed as a public mutable property in a library? - 70.How does Svelte handle
bind:valuebetween a parent$stateand a child$bindableprop? - 71.Why might a SvelteKit page with heavy
+layout.server.jsdata hurt navigation speed? - 72.What does
getRequestEventfrom$app/serverallow? - 73.Why do SvelteKit form actions return 303 redirects or
failinstead of rendering errors directly? - 74.How do you integrate an imperative third-party library (e.g. a chart) cleanly in Svelte 5?
- 75.What does a
prerenderremote function do?