Skip to content

"Encountered two children with the same key" #14

@mxmtsk

Description

@mxmtsk

I'm getting console errors regarding duplicate keys when using the Img.

This is the code I'm using:

          <Img
            src={require('./img1.jpg')}
            type="landingpageProject"
            className={styles.image}
            data-scroll
            data-scroll-speed="-2"
          />

          <Img
            src={require('./img2.jpg')}
            type="landingpageProject"
            className={styles.image}
            data-scroll
            data-scroll-speed="-2"
          />

Which results in:

react_devtools_backend.js:2273 Warning: Encountered two children with the same key, image/webp/1200. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
in picture (created by Img)
in Img (at projects/index.tsx:62)
in div (at projects/index.tsx:61)

I've tried to set custom key properties on each of the Images with no luck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions