useRef “refers to a value, but is being used as a type here.” May 5, 2023 by Tarik In my case, I renamed the file as .ts instead of .tsx. Renaming it again fixed it.