React
14
Вклад в тег
handleChangeInfoMain: (value: string) => void
const updateSearch: ChangeEventHandler<HTMLInputElement> = (event) => {};
или
const updateSearch = (event: ChangeEvent<HTMLInputElement>) => {};
onChange?: ChangeEventHandler<T> | undefined;
i === 0 && useAuth()
type THash = {
id: number;
hash: string;
};
type TChannel = {
channelid: number;
childrenHash: THash[];
};
type TData = TChannel[];
type THashAcc = Record<THash["hash"], THash["id"][]>;
export const comparsion = (data: TData) =>
data.map((n) => {
const ids = Object.values(
n.childrenHash.reduce<THashAcc>((acc, m) => ((acc[m.hash] ??= []).push(m.id), acc), {})
).filter((m) => m.length > 1);
return {
...n,
childrenHash: ids.length ? ids : null,
};
});