Closed MyNameIsBond closed 10 months ago
update: No need to do that, I updated the logic behind it, no errors now
import React, { ReactElement } from 'react'
interface SvgIconProps {
name: string
[key: string]: any
}
const SvgtoReact: React.FC<SvgIconProps> = ({
name,
...props
}: SvgIconProps): ReactElement | null => {
try {
const svg = require(`../public/svg/${name}.svg`).default
return React.createElement(svg, { ...props })
} catch (error) {
console.error(`SVG file not found for ${name}`)
return null
}
}
export default SvgtoReact
This component is widely used in the project it should be removed as it causes a cumulative shift layout.
and in NextJS 14 it does not work properly