Horje
use ref in component reactjs Code Example
use ref in component reactjs
class AutoFocusTextInput extends React.Component {
  constructor(props) {
    super(props);
    this.textInput = React.createRef();  }

  componentDidMount() {
    this.textInput.current.focusTextInput();  }

  render() {
    return (
      <CustomTextInput ref={this.textInput} />    );
  }
}
use ref in component reactjs
function CustomTextInput(props) {
  return (
    <div>
      <input ref={props.inputRef} />    </div>
  );
}

class Parent extends React.Component {
  render() {
    return (
      <CustomTextInput
        inputRef={el => this.inputElement = el}      />
    );
  }
}




Javascript

Related
classlist.contain in javascript Code Example classlist.contain in javascript Code Example
evento tecla enter javascript Code Example evento tecla enter javascript Code Example
order array of objects by id javascript Code Example order array of objects by id javascript Code Example
jquery function return Code Example jquery function return Code Example
console log return from async Code Example console log return from async Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7