title: How can I get the element of another component in React.js?
body: <p>I have two components CarouselComponent and BannerComponent nested to App Component. 
  I would liked to get the  element in BannerComponent in CarouselComponent for scrolling function.</p>
  
  <p>Code is here;</p>
  
  <p>--- App.js</p>
  
  <pre><code>....
  &lt;App&gt;
     &lt;BannerComponent /&gt;
     &lt;CarouselComponent /&gt;
  &lt;/App&gt;
  ....
  </code></pre>
  
  <p>--- BannerComponent.js</p>
  
  <pre><code>...
  return(
  &lt;div className="banner-div" id="banner-div"&gt;
  &lt;/div&gt;
  );
  ...
  </code></pre>
  
  <p>--- CarouselComponent.js</p>
  
  <pre><code>...
  scrollTo() {
    document.getElementById("banner-div") //  This doesn't work
  }
  ...
  
  return(
  &lt;a onClick={this.scrollTo}&gt;&lt;/a&gt;
  ); 
  </code></pre>
  
  <p>I wanna know how to get element in react js in all situations.</p>