title: How to get json with Vue and Fetch Api
body: <p>I have a simple code based on Vue.js:</p>
  
  <pre><code>const app = new Vue({
      el: 'vue-app',
      data: {
          displayedBooks: {}
      },
      created() {
          fetch('/library').then(response =&gt; response.json())
              .then((data) =&gt; this.data.displayedBooks = data);
      }
  });
  </code></pre>
  
  <p>But I got an exception:</p>
  
  <blockquote>
    <p>Uncaught (in promise) TypeError: Cannot set property 'displayedBooks' of undefined at fetch.then.then (main.js:8)</p>
  </blockquote>
  
  <p>Why this simple code is not works well?</p>