S
SolidJS14mo ago
aryzing

How is a Context reactive?

The tutorial states that
Using Context has the benefit of being created as part of the reactive system and managed by it
Not sure if I'm understanding this correctly. When trying to trigger reactivity, changing the context value does not seem to be re-rendering the app. However, if the context contains reactive values like signals or stores, updating their values does trigger a re-render. Therefore, would it be more correct to state that the context is not reactive, although it may contain reactive values
3 Replies
fabiospampinato
fabiospampinato14mo ago
Yes, the context is not reactive by itself, it just sets some data on "owners" (like roots, effects, memos), more or less
aryzing
aryzingOP14mo ago
Thanks @fabiospampinato . If you could, what do you mean by setting "owners"? Is that what the tutorial considers the "reactive system" managing the context?
fabiospampinato
fabiospampinato14mo ago
I think so. Basically one way of how reactivity works is that there are objects wrapping functions, some of these objects are effects, memos and roots. These wrappers are called "owners" internally, basically, Each owner knows the owner it got called under, each owner has an object containing context data, and when you read data from the context you just look up the nearest owner and perform a lookup in that data object
Want results from more Discord servers?
Add your server