Traté de hacer una matriz de ref usando la función de devolución de llamada.
class A extends React.Component { const arr=[1,2,3,4,5]; constructor(props) { super(props); this.inputs = []; } componentDidMount() { console.log(this.inputs, this.inputs.length, this.inputs[0]) // here length of inputs is 0 and inputs[0] is undefined } render() { return( <div> arr.map((key, index) => ( <Input key={key} ref={input => this.inputs[index] = input} /> <button type="button" onClick={this.inputs[index].current.focus()}>Focus</button> //here is got error as inputs[0] is undefined ) ) </div> ; } }Estoy enfrentando dos problemas