Skip to content

task solution#1797

Open
DmitriyS2k wants to merge 2 commits into
mate-academy:masterfrom
DmitriyS2k:develop
Open

task solution#1797
DmitriyS2k wants to merge 2 commits into
mate-academy:masterfrom
DmitriyS2k:develop

Conversation

@DmitriyS2k

Copy link
Copy Markdown

@DmitriyS2k DmitriyS2k changed the title Develop task solution Jun 1, 2026
Comment thread src/pages/PeoplePage.tsx
Comment on lines +148 to +171
if (sort) {
filteredPeople.sort((a, b) => {
switch (sort) {
case 'name':
return a.name.localeCompare(b.name);

case 'sex':
return a.sex.localeCompare(b.sex);

case 'born':
return a.born - b.born;

case 'died':
return a.died - b.died;

default:
return 0;
}
});

if (order === 'desc') {
filteredPeople.reverse();
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be pure function, which you move outside component, import and use in this place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants