Skip to content

Commit fbe38d6

Browse files
committed
Wrap HourMark and MinuteMark components in memo()
1 parent a4569e2 commit fbe38d6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/HourMark.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { memo } from 'react';
22

33
import Mark from './Mark';
44

@@ -10,11 +10,13 @@ type HourMarkProps = React.ComponentProps<typeof Mark> & {
1010
number?: number;
1111
};
1212

13-
export default function HourMark({
13+
const HourMark = memo(function HourMark({
1414
formatHour = defaultFormatHour,
1515
locale,
1616
number,
1717
...otherProps
1818
}: HourMarkProps) {
1919
return <Mark number={number ? formatHour(locale, number) : null} {...otherProps} />;
20-
}
20+
});
21+
22+
export default HourMark;

src/MinuteMark.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import React from 'react';
1+
import React, { memo } from 'react';
22

33
import Mark from './Mark';
44

55
type MinuteMarkProps = React.ComponentProps<typeof Mark>;
66

7-
export default function MinuteMark(props: MinuteMarkProps) {
7+
const MinuteMark = memo(function MinuteMark(props: MinuteMarkProps) {
88
return <Mark {...props} />;
9-
}
9+
});
10+
11+
export default MinuteMark;

0 commit comments

Comments
 (0)