1. Add custom.d.ts to ./scr

    declare module '*.svg' {
      import React = require('react')
      export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>
      const src: string
      export default src
    }
  2. Import svg on your page

    import { ReactComponent as IconLogo } from '../assets/images/logo.svg'
  3. Usage

    <IconLogo height='10' />

添加新评论