title: api call for class component using componentWillRecieveProps
body: <ul>
  <li>I need to pass a search value through a <code>searchbar</code> component to <code>menubar</code> component to do a custom search</li>
  <li>so I took an existing functional component from code sandbox and converted into class component.</li>
  <li>but I am getting an error <code>App(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.</code></li>
  <li>I am trying to achieve through <code>componentWillRecieveProps</code></li>
  <li>can you tell me how to fix it.</li>
  <li>providing my code snippet and sandbox below.</li>
  </ul>
  
  <p><a href="https://codesandbox.io/s/eloquent-galileo-14874" rel="nofollow noreferrer">https://codesandbox.io/s/eloquent-galileo-14874</a></p>
  
  <pre><code>class App extends Component {
    state = {
      groupCheckBoxValues: [],
      groupRadioValue: "PRO"
    };
  
    componentWillReceiveProps({ search }) {
      console.log(search);
    }
  
    componentDidMount() {
      this.fetchdata("story");
    }
  
    fetchdata(type = "", search_tag = "") {
      var url = "https://hn.algolia.com/api/v1/search?tags=";
      fetch(`${url}${type}&amp;query=${search_tag}`)
        .then(res =&gt; res.json())
        .then(data =&gt; {
          this.props.getData(data.hits);
        });
    }
  
    render() {
      &lt;div&gt; testing&lt;/div&gt;;
    }
  }
  
  const rootElement = document.getElementById("root");
  ReactDOM.render(&lt;App /&gt;, rootElement);
  </code></pre>