reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
10.86k stars 7.45k forks source link

after introducing hooks this phrase is misleading #2066

Open Kiwka opened 5 years ago

Kiwka commented 5 years ago

after introducing hooks this part is misleading, as converting into class is no longer the only option, that can be used if state needed for the component

You should convert the component to a class if you need a ref to it, just like you do when you need lifecycle methods or state.

https://github.com/reactjs/reactjs.org/blob/aada3a308493614b7d5b4b438b5c345d7ecc6c53/content/docs/refs-and-the-dom.md#refs-and-function-components-refs-and-function-components

Ruffeng commented 5 years ago

If you want I can fix it an provide the link into the useRef link example

nickmccurdy commented 4 years ago

Duplicate of #2048