UseRef has the same power of persistence that useState has. It sustains the value through the component’s life-cycle, but the cool part is that it is synchronous. When I need to do something immediately and I need it for the flow of my code, then I aim for useRef.
Table of contents
Why you shouldn’t always use “useState”Why I love ` useRef`How useState worksConclusion2 Comments
Sort: