hidjou / classsed-graphql-mern-apollo

408 stars 255 forks source link

TypeError: (destructured parameter).post is undefined ? #15

Closed aindriu80 closed 4 years ago

aindriu80 commented 4 years ago

This tutorial was put up on https://www.youtube.com/watch?v=n1mdAPFq2Os only 3 weeks ago but a lot of the code is broken.

I'm getting the following error

TypeError: (destructured parameter).post is undefined

2020-11-06_20-58

import React from "react"; import { Button, Form } from "semantic-ui-react"; import gql from "graphql-tag"; import { useForm } from "../util/hooks"; import { useMutation } from "@apollo/react-hooks";

function PostForm() { const { values, onChange, onSubmit } = useForm(createPostCallback, { body: "", });

const [createPost, { error }] = useMutation(CREATE_POSTMUTATION, { variables: values, update(, result) { console.log(result); values.body = ""; }, }); function createPostCallback() { createPost(); } return (

Create a post

); }

const CREATE_POST_MUTATION = gql mutation createPost($body: String!) { createPost(body: $body) { id body createdAt username likes { id username createdAt } likeCount comments { id body username createdAt } commentCount } } ; export default PostForm;

aindriu80 commented 4 years ago

2020-11-06_21-10

aindriu80 commented 4 years ago

wrong import >< doh!