Skip to content

Commit

Permalink
Fix keys being spread
Browse files Browse the repository at this point in the history
Fixes this console warning:

React keys must be passed directly to JSX without using spread
  • Loading branch information
weotch committed Nov 27, 2023
1 parent d2faaf5 commit b59abe3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/LazyVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function LazyVideo({

{/* Implement lazy loading by not adding the source until ready */}
{ shouldLoad && sourceVariants.map(({ media, key }) => (
<Source {...{ key, videoLoader, src, media }} />
<Source key={ key } {...{ videoLoader, src, media }} />
))}
</video>
)
Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/PictureImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ export default function PictureImage(

{/* Make <source>s */}
{imageLoader && sourceVariants.map(({ type, media, key }) => (
<Source {...{
key,
<Source key={ key } {...{
widths: srcsetWidths,
imageLoader, sizes, src, type, media
}} />
Expand Down

0 comments on commit b59abe3

Please sign in to comment.