im using the apollo client api to fetch data from an api source
when i run npm run build
i get an invariant error 31
which states
Could not find "client" in the context or passed in as an option. ' +
        'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
        'instance in via options.
But my code is corrects and it works well on the localhost
i tried downgrading the apolloclient version
but i still get the error
this is my code
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import { useQuery, gql } from '@apollo/client'
export default function Data() {
      let Query = gql`{
        posts(first: 1000000000000000) {
          id
          title
          body
          date
          tag
          coverpic {
            id
            url
          }
        }
      }
      `
  const {error, loading, data} = useQuery(Query)
  console.log(data)
  if(error){
    return(
        <div>e</div>
    )
  }
  if(loading){
    return(
        <div>l</div>
    )
  }
  return (
  <div>
    {data.posts.map(thu => {
        return(
            <div key={thu.id}>{thu.title}</div>
        )
    })}
  </div>
  )
}
THIS IS MY INDEX.JS
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import { useQuery, gql } from '@apollo/client'
export default function Data() {
      let Query = gql`{
        posts(first: 1000000000000000) {
          id
          title
          body
          date
          tag
          coverpic {
            id
            url
          }
        }
      }
      `
  const {error, loading, data} = useQuery(Query)
  console.log(data)
  if(error){
    return(
        <div>e</div>
    )
  }
  if(loading){
    return(
        <div>l</div>
    )
  }
  return (
  <div>
    {data.posts.map(thu => {
        return(
            <div key={thu.id}>{thu.title}</div>
        )
    })}
  </div>
  )
}
PLS HELP ME I DONT KNOW WHAT ELSE TO DO