You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using @svgr/webpack, the generated React components for SVGs still include defaultProps, which results in the following warning in the console when using React.
"Warning: Component.defaultProps is not supported in React future releases. Use JavaScript default parameters instead."
I've tried various approches to reolve but no luck till now.
currently i'm using this config for the svgr/webpack
// svgr.config.js
{
expandProps: ,false
replaceAttrValues: {},
prettier: true,
typescript: true, // if you're using TypeScript
jsxRuntime: 'automatic', // or 'classic' depending on your setup
// Disable defaultProps
svgo: true,
svgoConfig: {
plugins: [
{
name: 'removeViewBox',
active: false,
},
],
},
template: (variables, { tpl }) => {
return tplimport * as React from 'react'; const ${variables.componentName} = ({ title = "default title", ...props }) => ( ${variables.jsx} ); export default ${variables.componentName};;
}
};