github YIZHUANG/react-multi-carousel 2.2.2
Change render method in infinite mode.

latest releases: 2.5.4, 2.5.3, 2.5.0...
6 years ago

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.

Don't miss a new react-multi-carousel release

NewReleases is sending notifications on new releases.