maxmarinich / react-alice-carousel

React responsive component for building content galleries, content rotators and any React carousels
MIT License
833 stars 91 forks source link

Render multiple carousel on one page cause error #165

Closed kappaxbeta closed 3 years ago

kappaxbeta commented 3 years ago

Hello folk,

the carousel is awesome, it works out of the box without jquery props for that.

I just saw when u Render two carousel, react will throw a error, becuase the render Item are wrapped where the key is always the same for diffrent instances.

in the file: react-alice-carousel/src/lib/react-alice-carousel.tsx and the function _renderStageItem, it would be helpful, if it would be possible to give the carousel a uniqe pre or suffix.

Cheers, Jens

maxmarinich commented 3 years ago

Hi, @kappaxbeta! Please, provide the code sample or error log. Also, check and inspect a live example with multiple galleries on the page.

kappaxbeta commented 3 years ago

Sure,

you just get this error in develop

Screenshot 2021-01-16 at 14 50 42

I took the screenshot on the page you reference, as you can see they use the same key in the loop for the slide stage-item-${index}

Screenshot 2021-01-16 at 14 48 38
maxmarinich commented 3 years ago

@kappaxbeta, could you provide a code sample?

maxmarinich commented 3 years ago

Closed as irrelevant. Live demo for inspecting is here.