Svelte · Senior · Question 20 of 75

Why can MediaQuery or reading localStorage at component init cause problems with SSR?

Explanation

Prefer CSS for responsive layout, read browser-only APIs in effects, or store preferences in cookies so the server can use them.

Further reading

Problem with a question

Svelte · Senior · question 20

Test yourself

Take the Svelte · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz