We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following steps simulate a normal http request
import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import "antd/dist/antd.css"; import "./index.css"; import { Carousel } from "antd"; class Test extends PureComponent { state = { projects: [] }; componentDidMount() { // 一秒后置空 setTimeout(() => { this.setState({ projects: [] }); }, 1000); // 两秒后设置数组后,默认选中丢失 setTimeout(() => { this.setState({ projects: [1, 2, 3, 4, 5] }); }, 2000); } render() { const { projects } = this.state; return ( <div> <Carousel> {projects.map(project => ( <div> <h3>{project}</h3> </div> ))} </Carousel> </div> ); } } export default Test; ReactDOM.render(<Test />, document.getElementById("container"));
Carousel renders the first slide and the first slick dot set active
Carousel renders the last slide and Lost slick dot active status
The text was updated successfully, but these errors were encountered:
You could give the Carousel a key Prop, to get it to properly rerender when the projects change:
key
<Carousel key={projects.length.toString()}>...
(I dont know if this is the best Solution, just a quick one i tried in your codesandbox :) )
Sorry, something went wrong.
Seems it's react-slick bug. Should add some workaround for this.
react-slick
zombieJ
Successfully merging a pull request may close this issue.
Reproduction link
Steps to reproduce
The following steps simulate a normal http request
What is expected?
Carousel renders the first slide and the first slick dot set active
What is actually happening?
Carousel renders the last slide and Lost slick dot active status
The text was updated successfully, but these errors were encountered: