title: how to set focus on input inside loop of react js
body: <p>I am trying to set focus on input whose parent div is clicked, am able to get the parent div event, I don't know how ref can help me inside this loop, any help will be appreciated.</p>
  
  <pre><code>select = (e,datas) =&gt; {
    selected = parseInt(e);
    this.setState({active: selected});
  }
  </code></pre>
  
  <p>HTML Below</p>
  
  <pre><code>Object.keys(this.state.cdata).map((id,val) =&gt; {
    return (
     &lt;div 
       key={val} 
       onClick={this.select.bind(this, this.state.cdata[id].id)}
      &gt;
       &lt;div className={(this.state.cdata[id].id === this.state.active)?'country-edit':''}&gt;
         &lt;i className="fa fa-globe" aria-hidden="true"&gt;&lt;/i&gt;
         &lt;div className="country-name"&gt;{this.state.cdata[id].name}&lt;/div&gt;
           &lt;input 
             type="text"
             value={this.state.cdata[id].name}
             className="hidden"
             onChange={this.edit}
             onKeyPress={this.check}
           /&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     )
  })
  </code></pre>