4

I'm currently working through a urql+react tutorial found here while also adding graphQL API calls to my own application.

In the tutorial the following code is provided to send a query to the server and render components based on the result

const FEED_QUERY = gql`
  {
    feed {
      links {
        id
        createdAt
        url
        description
      }
    }
  }
`

const LinkList = () => {
  const [result] = useQuery({ query: FEED_QUERY })
  const { data, fetching, error } = result
  
  if (fetching) return <div>Fetching</div>
  if (error) return <div>Error</div>
  
  const linksToRender = data.feed.links

  return (
    <div>
      {linksToRender.map(link => <Link key={link.id} link={link} />)}
    </div>
  )
}

this code runs correctly when I implemented the tutorial myself but when I try to add this exact code to my own application I get the following error(s)

Text

I have triple checked to make sure all the necessary urql and graphql dependencies are all installed in my application so I'm not sure what could be causing this issue.

Daniel Murphy
  • 330
  • 1
  • 2
  • 7

0 Answers0