Type 'MutableRefObject' Is Not Assignable To Type 'RefObject'. Types Of

[Solved] Type 'MutableRefObject' Is Not Assignable To Type 'RefObject'. Types Of | Typescript - Code Explorer | yomemimo.com
Question : Type 'MutableRefObject' is not assignable to type 'RefObject'. Types of property 'current' are incompatible. Type 'undefined' is not assignable to type 'HTMLInputElement | null'. TS2322

Answered by : important-ibis-is1gq7d74f03

const inputField = React.useRef() as React.MutableRefObject<HTMLInputElement>;

Source : | Last Update : Fri, 02 Jul 21

Answers related to Type 'MutableRefObject' is not assignable to type 'RefObject'. Types of property 'current' are incompatible. Type 'undefined' is not assignable to type 'HTMLInputElement | null'. TS2322

Code Explorer Popular Question For Typescript