jonasschmedtmann / ultimate-react-course

Starter files, final projects, and FAQ for my Ultimate React course
3.25k stars 1.99k forks source link

Incorrect initial Value when SortBy has an absence of value. #86

Closed yonathandevpro closed 2 months ago

yonathandevpro commented 2 months ago

const sortBy = searchParams.get("sortBy") || "startDate-asc";

This one is not that much of a breaking code, nevertheless, I just wanted to point it out. When there is no sorting preferences are selected, the sortBy has a defaultValue of startDate-asc, which is wrong because startDate-asc was not one of the options values associated with the sorting. i changed it to name-asc, as it is the first and default value of the options, so logically it made sense.

Feedbacks would be appreciated if I'm right or I'm not seeing some things.