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 itNot 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
Yes, the context is not reactive by itself, it just sets some data on "owners" (like roots, effects, memos), more or less
Thanks @fabiospampinato . If you could, what do you mean by setting "owners"? Is that what the tutorial considers the "reactive system" managing the context?
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