Skip to content

Commit

Permalink
feat(react): enable ref option for SVGR in JSX compiler (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwade authored Dec 3, 2024
1 parent ce4b1a0 commit dba1039
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/core/compilers/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const JSXCompiler = (async (
svg,
{
plugins: ['@svgr/plugin-jsx'],
ref: options.jsx === 'react',
},
{ componentName: camelize(`${collection}-${icon}`) },
)
Expand Down
10 changes: 4 additions & 6 deletions types/react.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
declare module 'virtual:icons/*' {
import type { SVGProps } from 'react'
import type React from 'react'
import type { ForwardRefExoticComponent, SVGProps } from 'react'

const component: (props: SVGProps<SVGSVGElement>) => React.ReactElement
const component: ForwardRefExoticComponent<SVGProps<SVGSVGElement>>
export default component
}
declare module '~icons/*' {
import type { SVGProps } from 'react'
import type React from 'react'
import type { ForwardRefExoticComponent, SVGProps } from 'react'

const component: (props: SVGProps<SVGSVGElement>) => React.ReactElement
const component: ForwardRefExoticComponent<SVGProps<SVGSVGElement>>
export default component
}

0 comments on commit dba1039

Please sign in to comment.