This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create useApolloClient.ts * Update index.ts * Import react, duh * Add semi (👀) * Throw on old React * Fix typecheck * chore(deps): update dependency @types/enzyme to v3.9.1 * chore(deps): update dependency react-testing-library to v6.0.2 * chore(deps): update dependency rollup to v1.7.0 * chore(deps): update dependency rollup-plugin-replace to v2.1.1 * chore(deps): update dependency typescript to v3.3.4000 * Adjust `useApolloClient` to return the `client` only We don't necessarily want to expose the entire `ApolloContext`. * Changelog updates
- Loading branch information
Showing
11 changed files
with
55 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { invariant } from 'ts-invariant'; | ||
|
||
import { ApolloContext } from './ApolloContext'; | ||
|
||
export function useApolloClient() { | ||
const { client } = React.useContext(ApolloContext); | ||
invariant( | ||
!client, | ||
'No Apollo Client instance can be found. Please ensure that you ' + | ||
'have called `ApolloProvider` higher up in your tree.', | ||
); | ||
return client; | ||
} |