useRef "refers to a value, but is being used as a type here."
In my case, I renamed the file as .ts
instead of .tsx
. Renaming it again fixed it.
AnimatedCircle
is a function, not a type. This means it cannot be used in TypeScript in place of a type, like in the generic constraint of useRef
. Instead, you need to use the typeof operator
to convert to a type:
const circleRef = useRef<typeof AnimatedCircle | null>(null);