Skip to content

Commit

Permalink
fix(youtube-embed): each child in a list should have a unique "key" p…
Browse files Browse the repository at this point in the history
…rop (#57579)

Hi,

I added a key in the map iteration of scripts in Youtube Embed. I use the index as a key but maybe there are a better solution about this like script.url + index 🤔 

There isn't open related issues with this PR as this moment.

```js
      {scripts?.map((script, index) => (
        <Script
          key={index}
          src={script.url}
          strategy={scriptStrategy[script.strategy] as ScriptProps['strategy']}
          stylesheets={stylesheets}
        />
      ))}
```
  • Loading branch information
RodrigoTomeES authored Oct 31, 2023
1 parent 240730f commit df67fa1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/third-parties/src/google/youtube-embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function YouTubeEmbed(props: YouTubeEmbedTypes) {
>
{scripts?.map((script) => (
<Script
key={script.url}
src={script.url}
strategy={scriptStrategy[script.strategy] as ScriptProps['strategy']}
stylesheets={stylesheets}
Expand Down

0 comments on commit df67fa1

Please sign in to comment.