diff --git a/src/components/TaskList.tsx b/src/components/TaskList.tsx index c8c29ef..ab66133 100644 --- a/src/components/TaskList.tsx +++ b/src/components/TaskList.tsx @@ -26,34 +26,30 @@ const sortSelector = createSelector( (entries) => entries.sort((a, b) => a.title.localeCompare(b.title)) ); -class TaskList extends React.PureComponent { - public props: { - entries: TaskType[]; - onItemClick: (entry: TaskType) => void; - }; - - public render() { - const entries = this.props.entries.filter((x) => !x.finished); - const sortedEntries = sortSelector(entries); - - const itemList = sortedEntries.map((entry) => { - const uid = entry.uid; - - return ( - - ); - }); +interface PropsType { + entries: TaskType[]; + onItemClick: (entry: TaskType) => void; +} + +export default React.memo(function TaskList(props: PropsType) { + const entries = props.entries.filter((x) => !x.finished); + const sortedEntries = sortSelector(entries); + + const itemList = sortedEntries.map((entry) => { + const uid = entry.uid; return ( - - {itemList} - + ); - } -} + }); -export default TaskList; + return ( + + {itemList} + + ); +});