Skip to content

Share global context that will be updated asynchronously from host to child app #1242

Answered by Amirko28
SergiuszMinsk asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not 100% sure about this, but I think you can share the Context between the host and the child app by passing the Context instance that was created in the host:
const Auth0Context = React.createContext(defaultValue)

to the child app as a prop, and then re-declare the provider inside the child app like this:
<Auth0Context.Provider value={value}> ... </Auth0Context.Provider>

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@nkalinov
Comment options

@ScriptedAlchemy
Comment options

Answer selected by ScriptedAlchemy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants