antd走马灯goTo正确使用姿势
我用的版本
{"antd": "^5.4.2","react": "^18.2.0",
}
示例代码
... ...
const carouselRef = React.createRef();const App: React.FC = () => {... ...const handleChange = (index: string) => {carouselRef.current.goTo(index);};... ...onChange={() => handleChange(index)}... ...return ( <Carouseleffect="fade"autoplay={false}dots={false}ref={carouselRef}>... ...<div><h3>... ...</h3></div>... ...</Carousel>);
};