Closed GautierT closed 2 years ago
here you have the answer :)
Thanks a lot !
All I was doing wrong was not explicitly including "null" as the parameter in the useRef initialization (it expects null, not undefined).
If you create a ref with undefined
const ref = useRef<HTMLDivElement> = useRef()
the returned type is MutableRefObject<HTMLDivElement | undefined>
If you create a ref with null
const ref = useRef<HTMLDivElement> = useRef(null)
the returned type is RefObject
that was the problem
Thank you!
Hi.
I'm using typescript and i need to type the countdownRef
What should I do ? Thanks.