blob: a234268c3f3b1a387c662aa32bcc4ffadad0d3e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { FunctionComponent, useMemo } from "react";
import { useLanguageProfiles } from "@/apis/hooks";
interface Props {
index: number | null;
empty?: string;
}
const LanguageProfileName: FunctionComponent<Props> = ({
index,
empty = "Unknown Profile",
}) => {
const { data } = useLanguageProfiles();
const name = useMemo(
() => data?.find((v) => v.profileId === index)?.name ?? empty,
[data, empty, index],
);
return <>{name}</>;
};
export default LanguageProfileName;
|