I have this component:
import React from \'react\'; export default class AddItem extends React.Component { add() { this.props.onButtonClick(this.input.
this.input is undefined until the ref callback is called. Try setting this.input to some initial value in your constructor.
this.input
ref
From the React docs on refs, emphasis mine:
the callback will be executed immediately after the component is mounted or unmounted