title: React TypeError: Cannot read property 'getDates' of undefined
body: <p>today i decided to update the dependencies of my react project and my component <code>Home</code> didn't work anymore, i'm actually working with a apollo client and apollo react hooks, this is mi <code>Home</code> component file:</p>
  
  <pre><code>function Home(props) {
      const {
          loading,
          data: { getPosts: posts }
      } = useQuery(FETCH_POSTS_QUERY);
  
      return (
          &lt;Grid columns={3} stackable={true} className={loading ? 'loading' : ''}&gt;
              &lt;Grid.Row className='page-title'&gt;
                  &lt;h1&gt;Recent Posts&lt;/h1&gt;
              &lt;/Grid.Row&gt;
              &lt;Grid.Row&gt;
                  {user &amp;&amp; (
                      &lt;Grid.Column&gt;
                          &lt;PostForm user={user} /&gt;
                      &lt;/Grid.Column&gt;
                  )}
                  {loading ? (
                      &lt;Loading /&gt;
                  ) : (
                      posts &amp;&amp;
                      posts.map(post=&gt; (
                          &lt;Grid.Column key={post._id} style={{ marginBottom: 20 }}&gt;
                              &lt;PostCard post={post} /&gt;
                          &lt;/Grid.Column&gt;
                      ))
                  )}
              &lt;/Grid.Row&gt;
          &lt;/Grid&gt;
      );
  }
  </code></pre>
  
  <p>and i'm getting this error in the browser:
  <strong>"TypeError: Cannot read property 'getPosts' of undefined"</strong></p>
  
  <p>i'm trying to fix it with this little code variation:</p>
  
  <pre><code>function Home(props){
      let posts = '';
      const { user } = useContext(AuthContext);
      const { loading, data } = useQuery(FETCH_POSTS_QUERY);
  
      if (data) {
          posts = data.getPosts;
      }
  </code></pre>
  
  <p>And everything works fine, but if i add a new Post updating the apollo cache, that cache update correctly with old posts and new post, but the frontend didn't show it, only show old posts until i refresh the page manually.</p>
  
  <p>Edit:
  This is the code from the <code>PostForm</code> component, i updated the <code>Home</code> component too adding the <code>PostForm</code>:</p>
  
  <pre><code>function PostForm(props) {
      const { values, handleChange, handleSubmit } = useForm(createPostCallback, {
          title: 'Example Title',
          body: ''
      });
  
      const [createPost] = useMutation(CREATE_POST_MUTATION, {
          variables: values,
          update(dataProxy, result) {
              const data = dataProxy.readQuery({
                  query: FETCH_POSTS_QUERY
              });
              data.getPosts = [result.data.createPost, ...data.getPosts];
              dataProxy.writeQuery({
                  query: FETCH_POSTS_QUERY,
                  data
              });
              values.body = '';
          }
      });
  
      function createPostCallback() {
          createPost();
      }
  </code></pre>
  
  <p>Any idea how to fix the first code issue?
  Thanks in advance mates!</p>