Skip to content

Commit

Permalink
chore: use the React.Children util over Array.map
Browse files Browse the repository at this point in the history
see https://react.dev/reference/react/Children

Co-authored-by: Kelly Joseph Price <kellyjosephprice@gmail.com>
  • Loading branch information
rafegoldberg and kellyjosephprice committed Jun 18, 2024
1 parent c683a80 commit 8160700
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/CardsGrid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const CardsGrid = ({ columns = 2, children }) => {
columns = columns >= 2 ? columns : 2;
return (
<div className="CardsGrid" style={{ gridTemplateColumns: `repeat(${columns}, 1fr)` }}>
{(Array.isArray(children) ? children : [children]).map(e => (
{React.Children.map(children, e => (
<Card>{e}</Card>
))}
</div>
Expand Down

0 comments on commit 8160700

Please sign in to comment.