Change render method in infinite mode.
Commit: e865fab
Issue: #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.