A lightweight production-ready Carousel that rocks supports multiple items and server-side rendering with no dependency. Bundle size 2kb.
showDots
prop is true #107Huge thanks to @abhinavdalal-iconnect and @benhodgson87 for helping!
beforeChange
and afterChange
callbacks for goToSlide
#75Issue: https://github.com/YIZHUANG/react-multi-carousel/issues/48
Previously clones are only set once during the entire life cyle as the following:
componentDidMount(){
this.setState({ clones: whatever });
}
render(){
return (
<>
{this.state.clones.map.....}
</>
)
}
Using such approach works, but does not allow for advanced customization. For example:
const MyComponent = () => {
const [anyState, setAnyState] = useState(null);
return (
<Carousel
infinite={true}
beforeChange={() => setAnyState('anything')}
>
<CarouselItem anyState={anyState} />
// anyState will be null as always because Carousel item is not re-rendering.
</Carousel>
)
}
This commit fixes the above.
By passing className as a prop. https://github.com/YIZHUANG/react-multi-carousel/pull/42
Credits
Big thanks to @tpinne