@kaleon

Как передать аттрибут ref в Typescript?

Песочница
https://codesandbox.io/s/loving-chaum-6ykpg

Использую 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; }'
  • Вопрос задан
  • 986 просмотров
Решения вопроса 1
miraage
@miraage
Старый прогер
Вы реф вешаете на лейбл, а не на инпут.
const inputLabel = React.useRef<HTMLLabelElement>(null);


5e70bd734f9b7070465850.png
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы