Svelte · Junior · Question 42 of 76

When must setContext / getContext be called?

Explanation

Context is tied to the component being created. Since Svelte 5.40, createContext gives a typed [get, set] pair.

Further reading

Problem with a question

Svelte · Junior · question 42

Test yourself

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

Take this quiz