mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Add notes about composing multiple contexts
This commit is contained in:
@@ -91,8 +91,12 @@ A more complex example with dynamic values for the theme:
|
||||
|
||||
## Consuming Multiple Contexts
|
||||
|
||||
To keep context re-rendering fast, React needs to make each context consumer a separate node in the tree.
|
||||
|
||||
`embed:context/multiple-contexts.js`
|
||||
|
||||
If two or more context values are often used together, you might want to consider creating your own render prop component that provides both. [React Context Composer](https://github.com/FormidableLabs/react-context-composer/) is a simple library to help with this.
|
||||
|
||||
## Accessing Context in Lifecycle Methods
|
||||
|
||||
`embed:context/lifecycles.js`
|
||||
|
||||
Reference in New Issue
Block a user