Component ViewPhoto
\n<div key={v4()}>\n <article className={`${styles.photoItem} ${styles.photoItemOverlay}`} data-photo-modal-medium-id={medium._id}>\n <ImageComponent medium={medium} />\n </article>\n </div>
When specifying v4(), the library still uses its keys, how can I fix this?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"You should supply the key
attribute as part of the photo object in this case.
https://react-photo-album.com/documentation#Photo
","upvoteCount":1,"url":"https://github.com/igordanchenko/react-photo-album/discussions/110#discussioncomment-5695475"}}}-
I have a problem with duplicate keys. As I understand it, the keys for the cells are formed from the src tag, this is all clear and correct, but I have content loading and sometimes there is a duplicate photo in the uploaded content, which leads to errors in the console
renderColumnContainer={({ columnContainerProps, children }) => (
<div className={styles.photos__column}>{children}</div>
)}
renderContainer={({ containerProps, containerRef, children }: RenderContainerProps) => (
<div ref={containerRef} className={styles.photos}>
{children}
</div>
)}
renderPhoto={({ photo, wrapperStyle, renderDefaultPhoto }: any) => {
return (
<ViewPhoto medium={photo} />
)
}} Component ViewPhoto <div key={v4()}>
<article className={`${styles.photoItem} ${styles.photoItemOverlay}`} data-photo-modal-medium-id={medium._id}>
<ImageComponent medium={medium} />
</article>
</div> When specifying v4(), the library still uses its keys, how can I fix this? |
Beta Was this translation helpful? Give feedback.
-
You should supply the |
Beta Was this translation helpful? Give feedback.
You should supply the
key
attribute as part of the photo object in this case.https://react-photo-album.com/documentation#Photo