I'm sorry but that's bollocks. useRef has nothing to do with the DOM. It's stated clearly on the offical docs:
useRef returns a mutable ref object whose .current property is initialized to the passed argument (initialValue). The returned object will persist for the full lifetime of the component.
Please don't spread false information.
useRef is useful whenever you want to reference the same value on every render, but not trigger a re-render when its value changes.
@mrtnbroder apparently you're right, my bad. I just need to remove the "DOM" part in that comment, will edit it now. That's how I always understood the useRef hook. Thanks dude.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm sorry but that's bollocks.
useRef
has nothing to do with the DOM. It's stated clearly on the offical docs:Please don't spread false information.
useRef
is useful whenever you want to reference the same value on every render, but not trigger a re-render when its value changes.That's it. Thank you 👍
@mrtnbroder apparently you're right, my bad. I just need to remove the "DOM" part in that comment, will edit it now. That's how I always understood the useRef hook. Thanks dude.