Hacker News new | ask | show | jobs
by revskill 2582 days ago
Most of graphql client library is non-lazy on url part. In my apps, i use a lazy apollo client API interface though:

const data = useQuery(url, graphql_query, variables)

The point here is that, the ApolloClient is lazily constructed and reused only when the hook is called.

I don't know why Graphql must be used with non-lazy url instead.

More than that, you don't need a Provider, because the apollo-client is reused between the calls.