Typescript error with useTextField and useRef #2556
-
Hi there, I am trying to implement useTextField but I am getting a TypeScript error related to the use of the 'ref' hook on the input tag. I've played around with different variations, but it just seems to just move the error around. Code Sandbox of the issue I'm facing. I have used the code here as a base to build the above. Any help here would be much appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The
|
Beta Was this translation helpful? Give feedback.
The
useTextField
is returning attributes for either an HTMLInputElement, or HTMLTextAreaElement. When you spread the props onto an<input />
, you can cast it and that'd fix your TS errors: