reactjs - React: Losing ref values -
i using 2 components , using pattern: child component should stay isolated can - handling own validation error. parent component should check errors have dependencies between children. so, in case: password field , password confirmation field. here code: a) signup (parent) setting initial state. constructor() { super(); this.state = { ispasswordmatching: false }; } in render() method outputting child component. through prop called callback propagating method ispasswordmatching() binding parent's this . goal method can called within child component. <textinput id={'password'} ref={(ref) => this.password = ref} callback={this.ispasswordmatching.bind(this)} // other unimportant props /> <textinput id={'passwordconfirm'} ref={(ref) => this.passwordconfirm = ref} ... ispasswordmatching() method checking if passwords match (through refs this.password , this.passwordconfirm ) , ...