title: Login form using react js and JSON
body: <p>I am building a login form using JSON data. Code is as follows:</p>
  
  <pre><code>import React, { Component} from 'react';
  import ReactDOM from 'react-dom';
  import { Link } from 'react-router';
  import 'whatwg-fetch';
  class Login extends React.Component {
  
  constructor() {
      super();
      this.onSubmit = this.onSubmit.bind(this);
  }
  onSubmit() {
      fetch('http://xyz/check-login', {
          method: 'POST',
          headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
          },
          body: JSON.stringify({
              email: 'abc@abc.com',
              password: '123456',
          })
      })
  }
  &lt;form name="Login"&gt;
  &lt;div className="text-left"&gt;
  &lt;div className="row"&gt;
  &lt;div className="col-12"&gt;&lt;Input placeholder="Email Id" className="form-control"/&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div className="row"&gt;
  &lt;div className="col-12"&gt;&lt;Input placeholder="Password" type="password" className="form-control m-b-10"/&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;Button type="button" className="m-t-20 orange" label="Sign in " onClick={this.onSubmit} /&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>But its giving following error: </p>
  
  <blockquote>
    <p>Fetch API cannot load <a href="http://xyz/check-login" rel="nofollow noreferrer">http://xyz/check-login</a>. Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.</p>
    
    <p>Uncaught (in promise) TypeError: Failed to fetch</p>
  </blockquote>
  
  <p>Is this the correct method to do? </p>
  
  <p><sub>I am very new to react</sub></p>