If you want to make a reusable component and pass ref from a parent to children, you can use forwardRef. forwardRef is a HOC, that accepts components as a parameter. And, inside this component, we have access to
import React, { useRef } from 'react'This hook allows us to access a DOM element imperatively.Here’s an example, where I log to the console the value of the DOM reference of the span element that contains the count value:import React, { useState, useRef } from 'react' ...
// @flow import {useRef} from "react"; type HookRef<Value> = {| current: Value |}; const noValue = Symbol("lazyRef.noValue"); const useLazyRef = <Value>(getInitialValue: () => Value): HookRef<Value> => { const lazyRef = useRef(noValue); if (lazyRef.current === noValue) {...