yarn add apollo-client
import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client'
export default function App () {
const client = new ApolloClient({
uri: "http://연결할 ApolloClient 주소",
cache: new InMemoryCache()
})
return (
<ApolloProvider client={client}>
<Component {...pageProps}/>
</ApolloProcider>
)
}
graphql-codegen 설치


yarn add —dev @graphql-codegen/cliyarn add —dev @graphql-codegen/typescript
설치

schema: http://백엔드 graphql 주소
generates:
./src/commons/types/generated/types.ts:
plugins:
- typescript
config:
typesPrefix: I

"scripts": {
"generate": "graphql-codegen"
}
yarn generate 명령 실행