Skip to content

Commit

Permalink
fix for categories not sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
vjnvisakh-jtc committed May 25, 2024
1 parent 0188561 commit f4f550a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/Categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const Categories: React.FC = () => {
useEffect(() => {
if (!categories.length) {
getTriviaCategoriesFromGemini().then((result) => {
localStorage.setItem("categories", JSON.stringify(result));
setCategories(result.sort());
const sortedResults = result.sort();

localStorage.setItem("categories", JSON.stringify(sortedResults));
setCategories(sortedResults);
});
}
}, []);
Expand Down

0 comments on commit f4f550a

Please sign in to comment.