We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useContext
I'd love to see apollo take advantage of useContext in the new release of React.
potentially simplifying some of the work with Query Component, ApolloConsumer, etc.
e.g. (this is pseudo code)
import React, { useState, useEffect, useContext } from 'react'; import { ApolloContext, gql } from 'react-apollo'; function useQuery(query) { const [data, setData] = useState(null); const apollo = useContext(ApolloContext); function handleDataChange(data) { setData(data); } useEffect(() => { return apollo.watchQuery(query).valueChanges.subscribe(handleDataChange); }); return data; } function ListView() { const data = useQuery({ query: gql` { posts { title } } `, }); return ( <ol> {data.posts.map((item, index) => ( <li key={index}>{item.title}</li> ))} </ol> ); }
I'd expect useApollo, useQuery, useMutation, etc to be a hook apollo would provide
useApollo
useQuery
useMutation
The text was updated successfully, but these errors were encountered:
Started implementing feature here Added usage docs and examples for current implementation attempt: Apollo Hooks
Sorry, something went wrong.
No branches or pull requests
I'd love to see apollo take advantage of
useContext
in the new release of React.potentially simplifying some of the work with Query Component, ApolloConsumer, etc.
e.g. (this is pseudo code)
I'd expect
useApollo
,useQuery
,useMutation
, etc to be a hook apollo would provideThe text was updated successfully, but these errors were encountered: