Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Create useApolloClient.ts #2872

Merged
merged 16 commits into from
Mar 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Throw on old React
FredyC authored Mar 16, 2019
commit 0aa1427a844e914c035a4226d753699ffc8f3ab9
3 changes: 3 additions & 0 deletions src/useApolloClient.ts
Original file line number Diff line number Diff line change
@@ -2,5 +2,8 @@ import React from 'react';
import { ApolloContext } from './ApolloContext';

export function useApolloClient() {
if (!React.useContext) {
throw new Error('The useApolloClient needs React version 16.8 or higher');
}
return React.useContext(ApolloContext);
}