= useCallback(value => {
if (uuidVersions.is(value)) {
setUuidVersion(value);
}
- };
+ }, []);
const onGeneratesChange: InputProps["onChange"] = ({ currentTarget: { value } }) => {
const newGenerates = Number(value);
@@ -67,67 +67,58 @@ export default function Page() {
setUuids([...uuids, ...newUuids]);
};
- const hyphensConfig = useMemo(
- () => (
- }
- title="Hyphens"
- control={
-
- }
- />
- ),
- [hyphens]
+ const hyphensConfig = (
+ }
+ title="Hyphens"
+ control={
+
+ }
+ />
);
- const uppercaseConfig = useMemo(
- () => (
- }
- title="Uppercase"
- control={
-
- }
- />
- ),
- [uppercase]
+ const uppercaseConfig = (
+ }
+ title="Uppercase"
+ control={
+
+ }
+ />
);
- const uuidVersionConfig = useMemo(
- () => (
- }
- title="UUID version"
- description="Choose the version of UUID to generate"
- control={
-
- }
- />
- ),
- [uuidVersion]
+ const uuidVersionConfig = (
+ }
+ title="UUID version"
+ description="Choose the version of UUID to generate"
+ control={
+
+ }
+ />
);
const generatesInput = useMemo(
diff --git a/app/settings/page.tsx b/app/settings/page.tsx
index 537932e..a9d3d77 100644
--- a/app/settings/page.tsx
+++ b/app/settings/page.tsx
@@ -1,6 +1,5 @@
"use client";
-import { useMemo } from "react";
import { useTheme } from "next-themes";
import { singleTools } from "@/config/tools";
@@ -20,30 +19,27 @@ import { PageSection } from "@/components/page-section";
export default function Page() {
const { theme = "system", setTheme } = useTheme();
- const appThemeConfig = useMemo(
- () => (
- }
- title="App theme"
- description="Select which app theme to display"
- control={
-
- }
- />
- ),
- [setTheme, theme]
+ const appThemeConfig = (
+ }
+ title="App theme"
+ description="Select which app theme to display"
+ control={
+
+ }
+ />
);
return (
diff --git a/components/configuration.tsx b/components/configuration.tsx
index 420a1fe..54d900e 100644
--- a/components/configuration.tsx
+++ b/components/configuration.tsx
@@ -1,3 +1,6 @@
+import { memo } from "react";
+import equal from "react-fast-compare";
+
type Props = {
icon: React.ReactNode;
title: string;
@@ -5,7 +8,7 @@ type Props = {
control: React.ReactNode;
};
-export function Configuration({ icon, title, description, control }: Props) {
+function RawConfiguration({ icon, title, description, control }: Props) {
return (
{icon}
@@ -21,3 +24,5 @@ export function Configuration({ icon, title, description, control }: Props) {
);
}
+
+export const Configuration = memo(RawConfiguration, equal);