Created
February 27, 2019 17:07
-
-
Save madflanderz/0dbf09d1a6d35a6cd3414561b7c1864a to your computer and use it in GitHub Desktop.
useSmartQuery - useQuery hook with default fetchPolicy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useQuery, QueryHookOptions } from 'react-apollo-hooks' | |
function useSmartQuery<S, T>(query: any, options?: QueryHookOptions<T>) { | |
return useQuery<S>(query, { | |
fetchPolicy: 'cache-and-network', | |
...options, | |
}) | |
} | |
export default useSmartQuery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment