title: AJV JSON-Schema Validator with React not working
body: <p>I'm new to React World, currently trying to use AJV JSON-Schema Validator. When user upload Json file, I store it into state. Then after submitting I ran the validator. It's not working although in cosole.log it shows the data. Also if I hardcoded json into state like: </p>
  
  <pre><code>state = {
     file: {"foo": 2, "bar": 4}
  }
  </code></pre>
  
  <p>Then it's working fine. My code: </p>
  
  <pre><code>import React from 'react';
  let Ajv = require('ajv');
  // import axios from 'axios';
  
  
  class Form extends React.Component {
  
  state = {
      file: '',
  }
  
  handleSubmit = (e) =&gt; {
      e.preventDefault();
      console.log(this.state.file)
  
      let ajv = new Ajv({ allErrors: true });
      //Validation Rule
      let validate = ajv.compile(
          {
              "properties": {
                  "foo": { "type": "string" },
                  "bar": { "type": "number", "maximum": 3 }
              }
          }
      );
  
      let valid = validate(this.state.file);
  
      if (valid) {
          console.log('Valid!');
      } else {
          console.log('Invalid: ' + ajv.errorsText(validate.errors));
      }
  }
  
  // Handle Upload Using FileReader
  handleFile = (e) =&gt; {
      let reader = new FileReader();
      let file = e.target.files[0];
  
      reader.onloadend = (event) =&gt; {
          console.log(event.target.result);
          this.setState({
              file: event.target.result
          });
      }
  
      reader.readAsText(file)
  }
  
  
  render() {
      return (
          &lt;form onSubmit={this.handleSubmit}&gt;
              &lt;input type="file" onChange={this.handleFile}/&gt;
              &lt;button&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
      )
    }
  }
  </code></pre>
  
  <p>My Json Data : </p>
  
  <pre><code>{"foo": 2, "bar": 4}
  </code></pre>