tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Refs triggering errors #374

Closed pablocubico closed 8 years ago

pablocubico commented 8 years ago

I'm getting a few errors on components using string refs, as Dialog and Textfield.

captura de pantalla 2016-08-17 a las 12 45 12

See: https://facebook.github.io/react/warnings/refs-must-have-owner.html (not very helpful)

I solved it by using callback refs instead of string refs. Example here:

https://github.com/tleunen/react-mdl/compare/master...pablocubico:using-callback-refs-instead-of-strings?expand=1

String refs are on its way to deprecation as mentioned in:

@tleunen Would you agree on switching all string refs to callbacks?

tleunen commented 8 years ago

Not sure to understand why this is failing with string refs, but I definitely agree to change all string refs for string callbacks ;)

Do you want to help on this? A PR is very welcome :)

pablocubico commented 8 years ago

The problems of string refs have been outlined in an answer here by Dan Abramov, check out specially the last two points (3 & 4):

https://news.ycombinator.com/item?id=12090484

I'll make a PR.