Skip to content

Commit fcfad5a

Browse files
pngwnConduitry
authored andcommitted
Document that context is not reactive. (#3296)
1 parent e82d5d4 commit fcfad5a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

site/content/docs/03-run-time.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ Like lifecycle functions, this must be called during component initialisation.
156156
</script>
157157
```
158158

159+
> Context is not inherently reactive. If you need reactive values in context then you can pass a store into context, which *will* be reactive.
160+
159161
#### `getContext`
160162

161163
```js

site/content/tutorial/15-context/01-context-api/text.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ In `mapbox.js` you'll see this line:
4444
const key = {};
4545
```
4646

47-
We can use anything as a key — we could do `setContext('mapbox', ...)` for example. The downside of using a string is that different component libraries might accidentally use the same one; using an object literal means the keys are guaranteed not to conflict in any circumstance, even when you have multiple different contexts operating across many component layers.
47+
We can use anything as a key — we could do `setContext('mapbox', ...)` for example. The downside of using a string is that different component libraries might accidentally use the same one; using an object literal means the keys are guaranteed not to conflict in any circumstance, even when you have multiple different contexts operating across many component layers.
48+
49+
> Remember that context is not inherently reactive. If you need context values to be reactive then you can pass a store into context, which *will* be reactive.

0 commit comments

Comments
 (0)