Skip to content

Commit 14bbffa

Browse files
committed
fix defaultProps warning with React 18
1 parent 18f2de2 commit 14bbffa

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

.changeset/late-chairs-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-share": patch
3+
---
4+
5+
Fixed `createIcon` defaultProps warning with React 18.

src/hocs/createIcon.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ type IconConfig = {
1717

1818
export default function createIcon(iconConfig: IconConfig) {
1919
const Icon: React.FC<Props> = ({
20-
bgStyle,
21-
borderRadius,
22-
iconFillColor,
23-
round,
24-
size,
20+
bgStyle = {},
21+
borderRadius = 0,
22+
iconFillColor = 'white',
23+
round = false,
24+
size = 64,
2525
...rest
2626
}) => (
2727
<svg viewBox="0 0 64 64" width={size} height={size} {...rest}>
@@ -42,12 +42,5 @@ export default function createIcon(iconConfig: IconConfig) {
4242
</svg>
4343
);
4444

45-
Icon.defaultProps = {
46-
bgStyle: {},
47-
borderRadius: 0,
48-
iconFillColor: 'white',
49-
size: 64,
50-
};
51-
5245
return Icon;
5346
}

0 commit comments

Comments
 (0)