title: vue js Cannot read property 'data' of undefined*
body: <p>I am new to vue js.</p>
  
  <p><strong>this.comments.unshift(response.body.data); is not working.</strong> </p>
  
  <p>I did not use json() like <strong>this.comments.unshift(response.json().data);</strong> and <strong>this.comments = response.json().data;</strong> because using json() does not show any comments. I just searched and someone mentioned to use 'body' instead of json().</p>
  
  <p>Saving a comment in database is working. Only problem is showing a new comment is not working without refresh page.</p>
  
  <p>These are error messages</p>
  
  <p><em>[Vue warn]: Error in render function: "TypeError: Cannot read property 'data' of undefined"
   TypeError: Cannot read property 'data' of undefined</em></p>
  
  <p>Thank you very much.</p>
  
  <pre><code>&lt;script&gt;
  export default {
      data () {
          return {
              comments: [],
              body: null
          }
      },
      props: {
          postid: null
      },
      methods: {
          getComments () {
              this.$http.get('/blog/' + this.postid+ '/comments').then((response) =&gt; {                    
                  this.comments = response.body.data;
              });
          },
          createComment () {
              this.$http.post('/blog/' + this.postid+ '/comments', {
                  body: this.body
              }).then((response) =&gt; {
              //  console.log(this.body);
                  this.comments.unshift(response.body.data);
                  this.body = null;
              });
          }
      },
      mounted () {
          this.getComments();
      }   }
  
  &lt;/script&gt;
  </code></pre>