Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Understand how to solve the circular dependency issue with Contexts #57

Open
varghesethomase opened this issue Nov 25, 2019 · 1 comment

Comments

@varghesethomase
Copy link

I have two Contexts.

  1. User context
  2. Authentication context
    I have both of them dependent on each other. Eg: signout is in auth. But create user is dependent on authentication as it has to set user as authenticated after getting the user. And authentication context would have to set user on the user context after login. But the application throws an error as the order in which the application is wrapped can be either be in one way like
<AuthContainer.Provider>
      <UserContainer.Provider>

or

<UserContainer.Provider>
  AuthContainer.Provider>

And this would throw an error like this
image

I would like to know if there is any way to solve this.

@varghesethomase varghesethomase changed the title [Question] Understand how the chain dependency issue with Contexts [Question] Understand how to solve the circular dependency issue with Contexts Nov 25, 2019
@export-mike
Copy link

move auth logic into UserContainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants