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
717 stars 22 forks source link

Gatsby plugin/example ? #19

Closed revskill10 closed 5 years ago

revskill10 commented 5 years ago

Firstly, thanks you for great work here ! It's such a breath air for a simple design for Graphql !

Secondly, do you have any example/guide on how to use this with Gatsby ?

jaydenseric commented 5 years ago

I don't know the best practices for integrating it with Gatsby, but once I release the epic React hooks graphql-react rewrite (very soon) we can look into it :)

Keep in mind I don't recommend anyone use Gatsby; Next.js is far superior. Gatsby can't SSR dynamic pages.

revskill10 commented 5 years ago

@jaydenseric I also think about the hook part, too, but don't know if it could solve the async part. My main use of Gatsby for me is to serve static data from legacy database system with knex.js . My use of graphql is for dynamic part with both nextjs and gatsby. I used both in one project currently.

jaydenseric commented 5 years ago

The React hooks rewrite is out in v8.0.0. I'm spending the rest of this week refactoring my current project to use hooks, and once I have something realistic to test against I'll be optimizing the useGraphQL hook (avoiding API changes).

Closing because I don't intend to directly support Gatsby like we do Next.js, although feel free to report back here if you discover anything that may help others :)