From 5d932fe2b250f70e9e33bc33d94f03b3974e9a89 Mon Sep 17 00:00:00 2001 From: Falco Nogatz Date: Wed, 10 Jul 2024 23:37:19 +0200 Subject: [PATCH] Use ES6 default properties instead of deprecated defaultProps property Fixes https://github.com/Iconscout/react-unicons/issues/86 and https://github.com/Iconscout/react-unicons/issues/64 The work on this PR was sponsored by [SUSI&James GmbH](https://susiandjames.com/) --- build/generate.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build/generate.js b/build/generate.js index 5b9ce9de..c3445c67 100644 --- a/build/generate.js +++ b/build/generate.js @@ -29,8 +29,7 @@ uniconsConfig.forEach(icon => { const template = `import React from 'react'; import PropTypes from 'prop-types'; -const ${name} = (props) => { - const { color, size, ...otherProps } = props +const ${name} = ({ color = 'currentColor', size = '24', ...otherProps }) => { return React.createElement('svg', { xmlns: 'http://www.w3.org/2000/svg', width: size, @@ -48,11 +47,6 @@ ${name}.propTypes = { size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }; -${name}.defaultProps = { - color: 'currentColor', - size: '24', -}; - export default ${name};` fs.writeFileSync(location, template, 'utf-8')