-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1053
base: master
Are you sure you want to change the base?
Solution #1053
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! A few things should be improved
src/components/PeopleFilters.tsx
Outdated
onCenturyFilterChange, | ||
}) => { | ||
const [selectedSex, setSelectedSex] = useState<string | null>(null); | ||
const handleSexFilterChange = (sex: string | null) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's redundant function wrapper. You can just use setSelectedSex
everywhere instead of handleSexFilterChange
src/components/PeoplePage.tsx
Outdated
return matchesQuery && matchesCentury && matchesSex; | ||
}); | ||
|
||
const sortedPeople = [...filteredPeople].sort((a, b) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can wrap it into useMemo to avoid recalculating it every time an unrelated state or search parameter changes. Same for filteredPeople
src/components/personLink.tsx
Outdated
return ( | ||
<td> | ||
<Link | ||
to={`./${person.slug}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It resets all filters. That unexpected behavior - should be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🔥
DEMO LINK