From 9ae370ac01ec42d58f0e9e3a0b18cc01bab0f2ad Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 24 Nov 2019 16:31:22 +0200 Subject: [PATCH] Task list: simplify sort function. --- src/components/TaskList.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/components/TaskList.tsx b/src/components/TaskList.tsx index 79376af..4437e68 100644 --- a/src/components/TaskList.tsx +++ b/src/components/TaskList.tsx @@ -23,20 +23,7 @@ const TaskListItem = React.memo((_props: any) => { const sortSelector = createSelector( (entries: TaskType[]) => entries, - (entries) => { - return entries.sort((_a, _b) => { - const a = _a.title; - const b = _b.title; - - if (a < b) { - return -1; - } else if (a > b) { - return 1; - } else { - return 0; - } - }); - } + (entries) => entries.sort((a, b) => a.title.localeCompare(b.title)) ); class TaskList extends React.PureComponent {