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 786
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ApolloProvider/ApolloConsumer implementation to use React 16…
….3 context API The old way of passing the context still exists side-by-side with the new way to allow gradual migration of <Query>, <Mutation> and other modules that access the context in the "old" way. This should unlock "user space" experiments with react hooks and react-apollo because if yoou want to access the context(client) in a hook, the context has to be exposed using the "new" context API closes #1937
- Loading branch information
Showing
5 changed files
with
62 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { createContext } from 'react'; | ||
import ApolloClient from 'apollo-client'; | ||
import { DocumentNode } from 'graphql'; | ||
|
||
|
||
export interface ApolloContextValue { | ||
client?: ApolloClient<Object>; | ||
operations?: Map<string, { query: DocumentNode; variables: any }>; | ||
} | ||
|
||
export default createContext<ApolloContextValue | undefined>(undefined); |
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