title: How to make live search on this name react js?
body: <p>I am trying to make live search for name in table but i can't make live search i don't know how to do this i wrote my code like this as i mentioned please help me how to make live search on name field foe table and in <code>Search</code> Page i used <code>onSubmit={this.props.loaddata</code> like this thanks</p>
  
  <pre><code>import React, { Component } from "react";
  import Search from "../../views/Cars/Search";
  
  class Search1 extends Component {
    constructor(props) {
      super(props);
      this.state = {
        query: []
      };
    }
  
    // Get Data from filter date
    getData = async e =&gt; {
      try {
        const search = e.target.elements.search.value;
        e.preventDefault();
        const res = await fetch(`https://swapi.co/api/people/?search=${search}`);
        const query = await res.json();
        console.log(query);
        this.setState({
          query: query.results
        });
      } catch (e) {
        console.log(e);
      }
    };
  
    async componentDidMount() {
      // let authToken = localStorage.getItem("Token");
      try {
        const res = await fetch(`https://swapi.co/api/people/`);
        const query = await res.json();
        // console.log(movie);
        this.setState({
          query: query.results
        });
      } catch (e) {
        console.log(e);
      }
    }
  
    render() {
      const options = this.state.query.map(r =&gt; &lt;li key={r.id}&gt;{r.name}&lt;/li&gt;);
      return (
        &lt;div&gt;
          &lt;Search loaddata={this.getData} /&gt;
          {options}
        &lt;/div&gt;
      );
    }
  }
  
  export default Search1;
  </code></pre>