Skip to content

Commit

Permalink
Wrap HourMark and MinuteMark components in memo()
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 26, 2023
1 parent a4569e2 commit fbe38d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/HourMark.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { memo } from 'react';

import Mark from './Mark';

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

export default function HourMark({
const HourMark = memo(function HourMark({
formatHour = defaultFormatHour,
locale,
number,
...otherProps
}: HourMarkProps) {
return <Mark number={number ? formatHour(locale, number) : null} {...otherProps} />;
}
});

export default HourMark;
8 changes: 5 additions & 3 deletions src/MinuteMark.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import React, { memo } from 'react';

import Mark from './Mark';

type MinuteMarkProps = React.ComponentProps<typeof Mark>;

export default function MinuteMark(props: MinuteMarkProps) {
const MinuteMark = memo(function MinuteMark(props: MinuteMarkProps) {
return <Mark {...props} />;
}
});

export default MinuteMark;

0 comments on commit fbe38d6

Please sign in to comment.