From 7ff5475e89bb15544200bb408700572544ca1242 Mon Sep 17 00:00:00 2001 From: xiaoboost Date: Tue, 25 Jun 2019 09:15:06 +0800 Subject: [PATCH] should use pure function --- src/useList.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/useList.ts b/src/useList.ts index 48bd36a7fd..084f83c04a 100644 --- a/src/useList.ts +++ b/src/useList.ts @@ -18,8 +18,8 @@ const useList = (initialList: T[] = []): [T[], Actions] => { { set, clear: () => set([]), - updateAt: (index, entry) => set(currentList => [...currentList.slice(0, index), entry, ...list.slice(index + 1)]), - remove: index => set(currentList => [...currentList.slice(0, index), ...list.slice(index + 1)]), + updateAt: (index, entry) => set(currentList => [...currentList.slice(0, index), entry, ...currentList.slice(index + 1)]), + remove: index => set(currentList => [...currentList.slice(0, index), ...currentList.slice(index + 1)]), push: entry => set(currentList => [...currentList, entry]), filter: fn => set(currentList => currentList.filter(fn)), sort: (fn?) => set(currentList => [...currentList].sort(fn)),