Доступ REACT ref из другого класса - PullRequest
0 голосов
/ 15 декабря 2018

в коде myfile.jsx ниже

class ButtonRenderer extends React.Component {
constructor(props) {
        super(props);
      }
      I want to access myref which is created in main class from here
  }


extend default class main extends React.Component {   
     constructor(props) {
        super(props);
      }
    this.myref= react.createRef();       

   return

       render

              <input id="bla" type="text" ref={this.myref} />

}

Я хочу получить доступ к ref, который создан в основном классе из класса buttonrenderer

...