Skip to content

Commit 7f7308c

Browse files
authored
chore: use default parameters replace defaultProps (#5839)
1 parent d1ce846 commit 7f7308c

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/components/Button.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import cn from 'classnames';
88
interface ButtonProps {
99
children: React.ReactNode;
1010
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
11-
active: boolean;
11+
active?: boolean;
1212
className?: string;
1313
style?: Record<string, string>;
1414
}
1515

1616
export function Button({
1717
children,
1818
onClick,
19-
active,
19+
active = false,
2020
className,
2121
style,
2222
}: ButtonProps) {
@@ -43,9 +43,4 @@ export function Button({
4343
);
4444
}
4545

46-
Button.defaultProps = {
47-
active: false,
48-
style: {},
49-
};
50-
5146
export default Button;

src/components/MDX/ExpandableCallout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const variantMap = {
5252
},
5353
};
5454

55-
function ExpandableCallout({children, type}: ExpandableCalloutProps) {
55+
function ExpandableCallout({children, type = 'note'}: ExpandableCalloutProps) {
5656
const contentRef = useRef<HTMLDivElement>(null);
5757
const variant = variantMap[type];
5858

@@ -78,8 +78,4 @@ function ExpandableCallout({children, type}: ExpandableCalloutProps) {
7878
);
7979
}
8080

81-
ExpandableCallout.defaultProps = {
82-
type: 'note',
83-
};
84-
8581
export default ExpandableCallout;

0 commit comments

Comments
 (0)