title: Passing data on an API call from parent to child container in react
body: <p>I am fairly new to react and I was stuck at something trivial I feel. So what I want to do is that I want to pass data from a parent component to child. My code looks like this.</p>
  
  <pre><code>getData(key) {
      let { getData } = this.props;
  
      if (getData.code === "ON") {
          Codeapi(getData._id[0])
          .then(res =&gt; console.log("Result is", res)),
          (error =&gt; console.log(error));
      }
      return (
          &lt;Dialog
              key={key}
              side="left"
              onImageClick={this.handleClick}&gt;
              &lt;ReactSlick /&gt;
              &lt;/Dialog&gt;
      );
  }
  </code></pre>
  
  <p>So basically I am just console logging the result out right now but I want to pass res somehow to the ReactSlick component which is wrapped inside Dialog component. How will I be able to use the res data in the ReactSlick component?</p>