jaydenseric / graphql-react

A GraphQL client for React using modern context and hooks APIs that is lightweight (< 4 kB) but powerful; the first Relay and Apollo alternative with server side rendering.
https://npm.im/graphql-react
MIT License
718 stars 22 forks source link

Fix preload SSR API for React v16.6 #11

Closed jaydenseric closed 6 years ago

jaydenseric commented 6 years ago

React v16.6 has some breaking changes to the way the new context API works, causing errors and warnings when attempting to use the preload SSR API, such as:

Warning: Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?
Warning: Failed prop type: The prop `graphql` is marked as required in `GraphQLQuery`, but its value is `undefined`.
Error: Cannot read property 'constructor' of undefined
      at new GraphQLQuery (file://lib/components.mjs:57:42)

I suspect react-apollo will encounter issues too: https://github.com/apollographql/react-apollo/issues/2530