title: TypeError: Cannot read properties of null in the template tag
body: <p>I'm getting a &quot;TypeError: Cannot read properties of null&quot; error in my Vue/Laravel application. I get data from API. I can access data in the script tag for example in mounted method but in the template I can't access the data.</p>
  <pre><code>&lt;template&gt;
  
      &lt;article class=&quot;hentry blog-post single-post single-post-v3&quot;&gt;
  
          &lt;router-link :to=&quot;'/kategori/'+post.category.slug&quot; class=&quot;post-category bg-primary&quot;&gt;{{post.category.title}}&lt;/router-link&gt;
  
                          
          &lt;h1 class=&quot;post-title&quot;&gt;{{post.title}}&lt;/h1&gt;
          
      ...
  
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
      components: {
          FeaturedPosts,
          Comments
      },
      async beforeRouteEnter(to, from, next) {
  
          const returned = (await axios.get(route(&quot;api.post&quot;, to.params.slug))).data.response
  
          next(vm =&gt; {
              vm.post = returned.post;
              vm.comments = (returned.comments != undefined) ? returned.comments.data : null;
              vm.commentsPagination = (returned.comments != undefined) ? returned.comments : null;
          });
  
      },
      data() {
          return {
  
              post: null,
              comments: null,
              commentsPagination: null,
  
          };
      },
  }
  &lt;/script&gt;
  </code></pre>
  <p>It gives &quot;Uncaught (in promise) TypeError: Cannot read properties of null (reading 'category')&quot;. I can access post.category in mounted() method but in the template I can't.</p>