我使用pure-react-carousel
库并尝试通过onClick
按钮的方法导航到特定幻灯片。
请解释我如何使用setStoreState
,因为我试图自己做(如文档中所写)并且我使用它的整个页面都是不可见的。我尝试使用this.props.carouselStore.setStoreState({ currentSlide: 2 })
.
当我添加导出 withStore 时,我的页面变得不可见。我得到以下错误。
Error is Uncaught TypeError: Cannot read property 'state' of undefined
my export
export default WithStore(MyComponent, state => ({
currentSlide: state.currentSlide,
}));