I am trying to pickup the MERNG stack and started following a tutorial. My problem is the exact one from the link below: TypeError: Cannot read property 'getPosts' of undefined functional components
Much progress was made towards solving the problem in the threads of the link above but the solution fell short since the person is still having the same TypeError after implementing the solutions.
***I just wanted to add that I went into my Register.js file and imported useContext from react and it seemed to fix my problem. When I took away the import the TypeError came back when clicking the Register button. Not sure if there's a reason for this. Not sure if useContext is directly related in solving the issue.
For background, the video I am following is https://www.youtube.com/watch?v=n1mdAPFq2Os
and my issue arose on 3:09:46 when I added props.history.push('/') to
const [addUser, {loading} = useMutation(REGISTER_USER, {
update(_, result){
console.log(result)
props.history.push('/');
}
}
Above code found in client>src>pages>Register.js
Link to github repo: https://github.com/hidjou/classsed-graphql-mern-apollo/tree/master/client
Link to deployed app: https://gracious-shannon-271ede.netlify.app/