From 66861a881c59526bbc2717a94ed5868c736916cf Mon Sep 17 00:00:00 2001 From: pngwn Date: Sat, 27 Jul 2019 00:21:27 +0100 Subject: [PATCH] Document that context is not reactive. --- site/content/docs/03-run-time.md | 2 ++ site/content/tutorial/15-context/01-context-api/text.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index dfd734b3c9..8d4fe3f630 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -156,6 +156,8 @@ Like lifecycle functions, this must be called during component initialisation. ``` +> Context is not inherently reactive, if you need reactive values in context then you can pass a store into context, which *will* be reactive. + #### `getContext` ```js diff --git a/site/content/tutorial/15-context/01-context-api/text.md b/site/content/tutorial/15-context/01-context-api/text.md index 3d095dd679..ef146772c5 100644 --- a/site/content/tutorial/15-context/01-context-api/text.md +++ b/site/content/tutorial/15-context/01-context-api/text.md @@ -44,4 +44,6 @@ In `mapbox.js` you'll see this line: const key = {}; ``` -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. \ No newline at end of file +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. + +> 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.