appleple / react-modal-video

Accessible React Modal Video Component
https://appleple.github.io/react-modal-video/
MIT License
177 stars 86 forks source link

Use function to create ref #3

Closed piaaaac closed 7 years ago

piaaaac commented 7 years ago

https://github.com/appleple/react-modal-video/blob/21f20f6c4e82e192953ad42518e6b22e1f5fca38/src/index.jsx#L105

lines 105 & 109.

steelydylan commented 7 years ago

That means I should change the code from ref='modal' to ref={this.createRef()} ?? and I want to know the reason

alexandrricov commented 7 years ago

I'm getting an error in console due to legacy syntax image

https://facebook.github.io/react/docs/refs-and-the-dom.html#legacy-api-string-refs

alexandrricov commented 7 years ago

I could help with moving to new api

piaaaac commented 7 years ago

It would be something like this: from ref='modal' to ref={(ref) => {this.refToModal = ref}} and then use this.refToModal to reference it elsewhere in the code

steelydylan commented 7 years ago

@alrykov Please help me to improve it. If you want to :) Pull requests are always welcome ;)

steelydylan commented 7 years ago

@piaaaac thanks I'll try