title: Axios Post Form with Reactjs
body: <p>So I have this post method with Axios and if I submit this, it said </p>
  
  <blockquote>
    <p>Uncaught (in promise) Error: Network Error
        at createError (createError.js:16)
        at XMLHttpRequest.handleError (xhr.js:87)</p>
  </blockquote>
  
  <p>If I use this method:</p>
  
  <pre><code>axios.post('http://localhost:5000/users', ({userid: this.state.userid})
  </code></pre>
  
  <p>it works. But if I add 2 or more arg to the axios post it gets error again:</p>
  
  <pre><code>axios.post('http://localhost:5000/users', ({userid: this.state.userid}, {fullname: this.state.fullname} ))
  </code></pre>
  
  <p>Here is my full code. As you can see I try different combinations of code, and it only works if I only pass 1 arg.</p>
  
  <pre><code>import React from 'react';
  import axios from 'axios';
  // import { Form } from 'antd';
  // import { List, Card, Form } from 'antd';
  
  export default class FormUser extends React.Component {
      // constructor(props) {
      //   super(props)
      //   this.state = {
        state = {
          userid: '',
          fullname: '',
          usergroup:'',
          emailid: '',
          mobile: '',
          title: '',
  
    };
  
    handleChange = event =&gt; {
      this.setState({ userid: event.target.value });
      this.setState({ fullname: event.target.value });
      this.setState({ usergroup: event.target.value });
      this.setState({ emailid: event.target.value });
      this.setState({ mobile: event.target.value });
      this.setState({ title: event.target.value });
    }
  
    handleSubmit = event =&gt; {
      event.preventDefault();
  
      // const userform = {userid: this.state.userid};
      // const fullnameForm = {fullname: this.state.fullname};
      // const usergroupForm = {usergroup: this.state.usergroup};
      // const emailidForm = {emailid: this.state.emailid};
      // const mobileForm = {mobile: this.state.mobile};
      // const titleForm = {title: this.state.title};
  
      axios.post('http://localhost:5000/users', ({userid: this.state.userid}, {fullname: this.state.fullname} )) 
      // { {userid: this.state.userid}, {fullname: this.state.fullname} , usergroup: this.state.usergroup, emailid: this.state.emailid, mobile: this.state.mobile, title: this.state.title }) 
      // { userform, fullnameForm, usergroupForm, emailidForm, mobileForm, titleForm }) 
        .then(res =&gt; {
          console.log(res);
          console.log(res.data);
        })
    }
  
    render() {
      return (
        &lt;form onSubmit={this.handleSubmit}&gt;
          &lt;label&gt;User Project ID:  &lt;input type="text" name="userid" onChange={this.handleChange}/&gt;&lt;/label&gt;&lt;br/&gt;
          &lt;label&gt;Full Name:  &lt;input type="text" name="fullname" onChange={this.handleChange}/&gt;&lt;/label&gt;&lt;br/&gt;
          &lt;label&gt;User Group:  &lt;input type="text" name="usergroup" onChange={this.handleChange}/&gt;&lt;/label&gt;&lt;br/&gt;
          &lt;label&gt;Email:  &lt;input type="text" name="emailid" onChange={this.handleChange}/&gt;&lt;/label&gt;&lt;br/&gt;
          &lt;label&gt;Mobile:  &lt;input type="text" name="mobile" onChange={this.handleChange}/&gt;&lt;/label&gt;&lt;br/&gt;
          &lt;label&gt;Title:  &lt;input type="text" name="title" onChange={this.handleChange}/&gt;&lt;/label&gt;
          &lt;button type="submit"&gt;Add&lt;/button&gt;
        &lt;/form&gt;
      )
    }
  }
  </code></pre>
  
  <p>AXIOS POST on Express</p>
  
  <pre><code>app.post('/users', function (req, res) {
    var postData = req.body;
    // postData.created_at = new Date();
    connection.query("INSERT INTO users SET ?", postData, function (error, results, fields) {
      if (error) throw error;
      console.log(results.insertId);
      res.end(JSON.stringify(results));
    });
  });
  </code></pre>