Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Support React.createContext #1937

Closed
gregberge opened this issue Apr 18, 2018 · 9 comments · Fixed by #2540
Closed

Support React.createContext #1937

gregberge opened this issue Apr 18, 2018 · 9 comments · Fixed by #2540
Labels

Comments

@gregberge
Copy link

I am the creator of Loadable Components. I would like to thank you for this awesome library. I inspired from your code, especially the getDataFromTree.

I found that React.createContext is not supported. I patched it in gregberge/loadable-components#65. You can take the patch, it works.

But I think it would be nice to create a separated package to walk a tree in React, a lot of other libraries rely on it.

@gregberge
Copy link
Author

Follow up facebook/react#12640

@andiwinata
Copy link

I think it is in this PR

@hamlim
Copy link

hamlim commented Apr 30, 2018

Are there any plans to release a 2.x minor that includes support for createContext?

@hamlim
Copy link

hamlim commented May 4, 2018

We also forked the getDataFromTree utility at my company in order to implement createContext support, would you all be interested in merging a PR with those changes if I opened one?

@Dremora
Copy link
Contributor

Dremora commented May 4, 2018

@hamlim would you mind putting this in a gist?

@hamlim
Copy link

hamlim commented May 5, 2018

Sure: https://gist.github.com/hamlim/58aec71b7d91871ee0d001621a4969e8

The createContext related changes happen around line 100

@piglovesyou
Copy link

piglovesyou commented Jun 25, 2018

I would definitely like this support. Without this, getDataFromTree on SSR does not load data when <Query> is under <Context.Consumer>.

@Dremora
Copy link
Contributor

Dremora commented Jun 25, 2018

@piglovesyou it's been resolved, see #1978.

@piglovesyou
Copy link

@Dremora Ah.. it's just great... it's on 2.1.6. Thanks for letting me know.

vovacodes added a commit to vovacodes/react-apollo that referenced this issue Oct 26, 2018
….3 context API

The old way of passing the context still exists side-by-side with the new way to allow gradual migration of <Query>, <Mutation> and other modules that access the context in the "old" way.

This should unlock "user space" experiments with react hooks and react-apollo because if yoou want to access the context(client) in a hook, the context has to be exposed using the "new" context API

closes apollographql#1937
vovacodes added a commit to vovacodes/react-apollo that referenced this issue Oct 27, 2018
….3 context API

The old way of passing the context still exists side-by-side with the new way to allow gradual migration of <Query>, <Mutation> and other modules that access the context in the "old" way.

This should unlock "user space" experiments with react hooks and react-apollo because if yoou want to access the context(client) in a hook, the context has to be exposed using the "new" context API

closes apollographql#1937
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
6 participants