Open chauchinyiu opened 3 years ago
I think re-rendering the carousel will do the trick.
when you received the new images, trigger a state to re-render the carousel
const [reRender, setReRender] = useState(false);
const getNewImage = () => {
... // received new images
setReRender(true); // trigger re-render once new images received
}
useEffect(() => {
if (reRender) {
setReRender(false) // we just want to re-render the carousel. So, when `reRender` value is true we set it back directly to false again.
}
}, [reRender]);
return (!reRender && <Carousel .../>)
Hello, I try to load different set of images in the carousel, however when i load a new set of images. the previous set of images is always there. i have to click the arrow button in order to show the new set of images in the carousel. the following code is my code. Is there any function to make carousel to remove all the images? Thanks for your attention