hidjou / classsed-graphql-mern-apollo

408 stars 255 forks source link

'data' is not defined #13

Closed mariusflorescu closed 4 years ago

mariusflorescu commented 4 years ago

- Issue located in: /client/src/pages/Home

const {
    loading,
    data: { getPosts: posts }
  } = useQuery(FETCH_POSTS_QUERY);

-Issue description: 'data' is not defined (twice) 😢

-Context: I think the problem is due to the migration to @apollo/client 3.0 (they've discussed something about some changes regarding loading / data)

-How I solved it: :

const{
    loading,
    data={}
  } = useQuery(FETCH_POSTS_QUERY);

const posts = data.getPosts;
aindriu80 commented 4 years ago

I was having this same problem ٩(͡๏̯͡๏)۶