增加用于删除Scheme的hook。
This commit is contained in:
parent
1560b37b60
commit
8696cd0a39
|
@ -113,3 +113,11 @@ export function useUpdateScheme(id: string): (updater: (prev: SchemeSet) => Sche
|
|||
);
|
||||
return updateAction;
|
||||
}
|
||||
|
||||
export function useRemoveScheme(id: string): () => void {
|
||||
const updateSchemes = useSetAtom(schemesAtom);
|
||||
const removeAction = useCallback(() => {
|
||||
updateSchemes((prev) => prev.filter((s) => !isEqual(id, s.id)));
|
||||
}, [updateSchemes, id]);
|
||||
return removeAction;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user