I want to use useRef()
on my extended component.
const ref = useRef<TextInputProps>(null);
This is the TextInputProps
:
export type TextInputProps = ThemeProps & DefaultTextInput['props'] & InputProps;
This is my element:
<Input ref={ref} onFocus={onMainTextInputFocus} placeholder={placeholder ?? '-- Select --'} value={selectedLabel} />
This is my Input
component:
export function Input(props: TextInputProps) { ....
This is the error:
(property) ref: React.RefObject Type '{ ref:RefObject; onFocus: () => void; placeholder: string;value: string | undefined; }' is not assignable to type'IntrinsicAttributes & ThemeProps & Readonly &Readonly<{ children?: ReactNode; }> & InputProps'. Property 'ref'does not exist on type 'IntrinsicAttributes & ThemeProps &Readonly & Readonly<{ children?: ReactNode; }> &InputProps'.
How do I fix this?