The refs in React are used to imperatively access native elements, being able to directly access their properties or calling functions present in these elements natively.
But within React, the use of refs doesn't stop there, we can use them for much more than that, such as storing values without new component renderings, transferring functionality from child components to the parent component and much more.
- master (just using fowardRef)
- useImperativeHandle (using ref, but with useImperativeHandle)