Skip to content
Snippets Groups Projects
Unverified Commit b474246f authored by Yves Hajjar's avatar Yves Hajjar Committed by GitHub
Browse files

Update chapter_5.md

parent bec2cb67
No related branches found
No related tags found
No related merge requests found
# Chapter 4 - Context
# Chapter 5 - Context
Context in Kayak UI allows users to pass data through the widget tree without having to pass data between each widget at every level in the tree.
Typically in Kayak the data is passed top-down or parent to child via "props", but this can be cumbersome when dealing with complex widget trees. Context provides a way to share values from a parent widget down to children without the need to explicitly pass that data through every level of the tree.
......@@ -45,4 +45,4 @@ fn my_child_widget_render(
When a widget is associated with context it's important that the widget update system is aware of this. By default the `widget_update` diff system is used. This accepts types for props and state but not for context. A separate system called `widget_update_with_context` can be used which takes an optional third type for context.
### Important!
`widget_update_with_context` is only designed to work with one type of context. If you need multiple context diffing for a single widget it's advised that you use a custom widget update system.
\ No newline at end of file
`widget_update_with_context` is only designed to work with one type of context. If you need multiple context diffing for a single widget it's advised that you use a custom widget update system.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment