import svg as component in react without typescript reference

Viewed 286

I've this import in my tsx

import { ReactComponent as FbLogo } from '../Icons/facebook_logo.svg'

but I got error of Module '"*.svg"' has no exported member 'ReactComponent'. Did you mean to use 'import ReactComponent from "*.svg"' instead?ts(2614)

I've no idea why, I don't understand the error. Then I saw in other repo, they added this line on the top of the file to solve it.

/// <reference types="vite-plugin-svgr/client" />

the error did go away, but to me it looks like a mystery. What it does exactly? Can we get rid of that? I'm using vite and typescript and react.

0 Answers
Related