I'm forwarding a ref to Child component as per the react docs: https://reactjs.org/docs/forwarding-refs.html.
const userRef = useRef<TextInput>(null);interface IWrappedComponent { ref?: RefObject<TextInput>;}const WrappedComponent = React.forwardRef((props: IWrappedComponent, ref) => { return <LogProps {...props} forwardedRef={ref} />;});interface ILogProps { innerRef?: RefObject<TextInput>;}
However I'm getting a type error for forwardedRef. I'm using RefObject<TextInput>
for type, but am getting the following:
Type 'ForwardedRef<unknown>' is not assignable to type 'RefObject<TextInput>'. Type 'null' is not assignable to type 'RefObject<TextInput>'.