title: Why won't my POST request update my data.json file?
body: <p>So a user should be able to fill the form out and submit, which should update the local JSON server with the new comment. Currently it is not working. I am using the proper port which I checked using json-server --watch db.json. What am I doing incorrectly?</p>
  <pre><code>class CommentForm extends Component {
    handleSubmit = (e) =&gt; {
      e.preventDefault();
      console.log(&quot;submitted&quot;);
  
      const body = e.target.body.value;
  
      fetch(&quot;http://localhost:3000/comments&quot;, {
        method: &quot;POST&quot;,
        body: JSON.stringify(body)
      }).then((response) =&gt; {
        console.log(response);
        return response.json(); // do something with response JSON
      });
    };
  
    render() {
      return (
        &lt;div&gt;
          &lt;h1&gt;What is your favorite breed?&lt;/h1&gt;
          &lt;form onSubmit={this.handleSubmit}&gt;
            &lt;label&gt;Answer: &lt;/label&gt;
            &lt;br /&gt;
            &lt;textarea type=&quot;text&quot; name=&quot;body&quot; /&gt;
            &lt;br /&gt;
            &lt;input type=&quot;submit&quot; /&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default CommentForm
  </code></pre>
  <pre><code>{
      &quot;comments&quot;: [
        { 
          &quot;text&quot;: &quot;Australian Shepherd!&quot;
        },
        { 
          &quot;text&quot;: &quot;German Shepherd!&quot;
        },
        { 
          &quot;text&quot;: &quot;Mutts all the way&quot;
        },
        { 
          &quot;text&quot;: &quot;Chihuahua&quot;
        },
        { 
          &quot;text&quot;: &quot;Great Pyrenees rock!!!&quot;
        }
      ]
    }
  </code></pre>