I did try searching for the same question but all of those were of either angular or unrelated,
I am trying to make a Social app using MongoDB, Express, React, Node, Graphql with Apollo, I am following a video from freecodecamp : Link to the video In that video everything worked fine but in his deployed version he is having the same error as mine
react_devtools_backend.js:2450 TypeError:
Cannot read property 'getPosts' of undefined
at ae (Home.js:14) at Jo (react-dom.production.min.js:3274)
My Code: I am dropping a link to my github repo containing the whole project : Link to github repo
Stack Overflow was throwing too many indentation issues so i have linked my github above as there is too much of code
- I'm using semantic-ui for styling
- I'm using graphql the fetch posts from MongoDB
- Apollo Client for rendering data
This is the error I am getting in the Home.js: Screen Shot of the error:
if(loading) { return "loading" };
before main return (and destructuring or any acces to deeper 'data' property) prevents this kind of errors – xadmerror
can be derived from hook, too and should block rendering like loading – xadmif(data) console.log(posts);
before return – xadm