From 7f71c89ffb7707c6ee0d95e0e0a0c55715735ad9 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Sat, 6 Jan 2024 23:48:47 -0700 Subject: [PATCH] Create apollo provider --- graphql/client.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 graphql/client.tsx diff --git a/graphql/client.tsx b/graphql/client.tsx new file mode 100644 index 0000000..369ed9b --- /dev/null +++ b/graphql/client.tsx @@ -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 {children}; +}; + +export default ApolloClientProvider;