Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The useRef pattern seem like a code smell, maybe because I had some troubles with refs over the years.

Things were simpler when we had lifecycle methods to manage some of this things. But I`m sure that the next version of react will change everything and make us come up with more patters to try to fix the same problem again...



useRef is quite useful when you want to use something externally that has it own lifecycle. And your only interaction is sporadic. Think animation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: