react forwardref inside forwardref react code example
Example 1: react forwardref
const FancyButton = React.forwardRef((props, ref) => (
<button ref={ref} className="FancyButton">
{props.children}
</button>
));
const ref = React.createRef();
<FancyButton ref={ref}>Click me!</FancyButton>;
Example 2: Did you mean to use React.forwardRef()?
import {useRef} from 'react';
const inputRef = useRef(null);
<section ref={inputRef} >...</section>
Example 3: send props to forwardref
<Component {...props} ref={ref} />