Create apollo provider
This commit is contained in:
		
							
								
								
									
										24
									
								
								graphql/client.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								graphql/client.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
import React from "react";
 | 
			
		||||
import {
 | 
			
		||||
	ApolloClient,
 | 
			
		||||
	InMemoryCache,
 | 
			
		||||
	ApolloProvider,
 | 
			
		||||
	HttpLink,
 | 
			
		||||
	from,
 | 
			
		||||
} from "@apollo/client";
 | 
			
		||||
import { API_URI } from "@env";
 | 
			
		||||
 | 
			
		||||
const httpLink = new HttpLink({
 | 
			
		||||
	uri: API_URI,
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const client = new ApolloClient({
 | 
			
		||||
	link: from([errorLink, httpLink]),
 | 
			
		||||
	cache: new InMemoryCache(),
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const ApolloClientProvider: React.FC = ({ children }) => {
 | 
			
		||||
	return <ApolloProvider client={client}>{children}</ApolloProvider>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default ApolloClientProvider;
 | 
			
		||||
		Reference in New Issue
	
	Block a user