The forwardRef hooks allows React users to pass refs to child components. The ref can be created and referenced with useRef
or createRef
and then passed in a parent component. Using forwardRef instead of useRef is useful when a ref needs to be accessed in a parent component.
Refs cannot be passed as props to functional components.
#web-development #programming #react-hook #react #javascript