我希望得到帮助,在我的React轮播组件中添加自定义箭头,但是我遇到了 "type未定义" 的错误,可以请有经验的人告诉我做错了什么吗?最好提供当前情况的解决方案。
谢谢。
谢谢。
import Carousel, { consts } from 'react-elastic-carousel';
import LeftArrow from './Assets/Group 1316.svg'
import RightArrow from './Assets/Group 1317.svg'
export default function BootcampNew (props) {
const breakPoints = [
{ width: 1, itemsToShow: 1 },
{ width: 550, itemsToShow: 2 },
{ width: 768, itemsToShow: 3 },
{ width: 900, itemsToShow: 4 },
];
type === consts.PREV;
const myArrow = ({type,onClick, isEdge}) => {
const pointer = type === consts.PREV ? {LeftArrow} : {RightArrow}
return(
<Button onClick={onClick} disabled={isEdge}>{pointer}</Button>
)
}
<Carousel
renderArrow={myArrow}
breakPoints={breakPoints}
pagination={false}>
<CourseCard/>
<Carousel/>