Skip to content

Instantly share code, notes, and snippets.

@hungdev
Last active May 24, 2018 02:58
Show Gist options
  • Select an option

  • Save hungdev/5885bb1feb3f27ee790ce19628d6ad86 to your computer and use it in GitHub Desktop.

Select an option

Save hungdev/5885bb1feb3f27ee790ce19628d6ad86 to your computer and use it in GitHub Desktop.
ref and refs
<ValidatePinModal
  onSubmit={(code) => this.onSubmit(code)}
  // ref='ValidatePinModal'
  ref={ref => {this.ValidatePinModal = ref}}
/>

must has onOpen() func

call this: this.ValidatePinModal.onOpen()

another way:

<ValidatePinModal
  onSubmit={(code) => this.onSubmit(code)}
  ref='ValidatePinModal'
/>
call this: this.refs.ValidatePinModal.onOpen()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment