Skip to content

Commit 3a0e1e5

Browse files
committed
Update documentation of how context is set
1 parent 0da2507 commit 3a0e1e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/reflexes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ class ExampleReflex(Reflex):
8383
def work(self):
8484
# All new instance variables in the reflex will be accessible
8585
# in the context during rendering.
86-
self.instance_variable = 'hello world'
86+
self.context.instance_variable = 'hello world'
8787

8888
context = self.get_context_data()
8989
context['a_key'] = 'a pink elephant'
90+
91+
self.context.update(context)
9092
# If "a_key" existed in the context before the reflex was triggered
9193
# the context variable will now be modified to "a pink elephant"
9294

9395
# if it didn't exist, the context variable is then created with the
9496
# data "a pink elephant" 🐘
95-
9697
```
9798
{% endtab %}
9899

0 commit comments

Comments
 (0)