K
K
kaleon2020-03-17 14:59:27
JavaScript
kaleon, 2020-03-17 14:59:27

How to pass ref attribute to Typescript?

Sandbox
https://codesandbox.io/s/loving-chaum-6ykpg

Using Material-UI

index.d.ts(768, 46): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes & InputLabelProps'
index.d.ts(768, 46): The expected type comes from property 'ref ' which is declared here on type 'IntrinsicAttributes & InputLabelProps & { children?: ReactNode; }'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2020-03-17
@kaleon

You ref hang on the label, not on the input.

const inputLabel = React.useRef<HTMLLabelElement>(null);

5e70bd734f9b7070465850.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question