我正在尝试添加React-Slick
应用程序,但不知何故我失败了,实际上我在应用程序中添加待办事项,然后在滑块中显示待办事项列表。当我存储一些待办事项时,我正在从服务器获取数据并在第一次尝试时将其显示在滑块中,但当我再次尝试时,它会显示。我将分享我的代码,请您检查并纠正我的问题。
代码
let settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
className: "slides",
adaptiveHeight: true
};
<Slider {...settings}>
{this.props.fetchTodos
? this.props.fetchTodos.rows.map(item => (
<div
className={`${
item.priority === "P1"
? "red-data"
: item.priority === "P2"
? "yello-data"
: item.priority === "P3"
? "green-data"
: ""
} mb-4 `}
>
<div>{item.title}</div>
<div>{item.description}</div>
<div className="mt-2">
<TodoListModal
color={`${
item.priority === "P1"
? "light"
: item.priority === "P2"
? "light"
: item.priority === "P3"
? "light"
: ""
}`}
title={item.title}
description={item.description}
priority={item.priority}
todoId={item.id}
/>
</div>
</div>
))
: ""}
</Slider>