React-apollo: Support React.createContext

Created on 18 Apr 2018  路  9Comments  路  Source: apollographql/react-apollo

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 https://github.com/smooth-code/loadable-components/pull/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.

has-PR

Most helpful comment

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

The createContext related changes happen around line 100

All 9 comments

I think it is in this PR

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

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?

@hamlim would you mind putting this in a gist?

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

The createContext related changes happen around line 100

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

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

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

Was this page helpful?
0 / 5 - 0 ratings