Skip to content

Commit

Permalink
useMemo before condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityblast committed Apr 24, 2024
1 parent 1ac2e0a commit d194034
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export function CollectionsGrid({
}: {
data: CommunityCollection[] | undefined;
}) {
// Shuffle the collections
const shuffled = useMemo(() => shuffle(data), [data]);

if (!data) {
return null;
}
// Shuffle the collections
const shuffled = useMemo(() => shuffle(data), [data]);

return (
<div className="md:grid space-y-4 md:space-y-0 md:grid-cols-4 gap-6">
Expand Down

0 comments on commit d194034

Please sign in to comment.