Skip to content

Commit 7311352

Browse files
committed
refactor: remove a useMemo where not needed
1 parent 33ed851 commit 7311352

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DateManager from "@/utilities/DateManager";
22
import classNames from "classnames";
33
import { useRouter } from "next/router";
4-
import React, { useCallback, useMemo } from "react";
4+
import React, { useCallback } from "react";
55

66
interface DurationBadgeProps {
77
value: number;
@@ -14,17 +14,14 @@ export default function DurationBadge({ value, type = "gray" }: DurationBadgePro
1414
if (!value) return 0;
1515
return DateManager.humanize(value, locale);
1616
}, []);
17-
const duration = useMemo(() => {
18-
return getDuration(value, router.locale as string);
19-
}, [router.locale, value, getDuration]);
2017
return (
2118
<div
2219
className={classNames("text-xxs uppercase font-semibold px-2 rounded-3xl inline-block text-gray-500 text-nowrap", {
2320
"bg-gray-200": type === "gray",
2421
"border border-gray-200": type === "bordered",
2522
})}
2623
>
27-
{duration}
24+
{getDuration(value, router.locale as string)}
2825
</div>
2926
);
3027
}

0 commit comments

Comments
 (0)