How to specify your key for photo blocks #110
|
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? |
Answered by
igordanchenko
Apr 22, 2023
Replies: 1 comment 1 reply
|
You should supply the |
1 reply
Answer selected by
igordanchenko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should supply the
keyattribute as part of the photo object in this case.https://react-photo-album.com/documentation#Photo