reactjs - React 如何将索引传递到地图功能之外?
问题描述
只是在旋转木马上工作。只是在结束时尝试禁用按钮。disabled={ index === 0 } 由于超出地图范围而无法正常工作。感谢您的帮助。
<Carousel settings={ settings } ref={ ref }>
{slides.map((el, index) => (
<SlideGallery key={ index }>
<SlideItems style={{ background: el.imgUrl }}>
<picture><img src={ el.imgUrl } alt=''></img></picture>
<SlideInner>
<h3>{el.review}</h3>
<p></p>
<p>UserName</p>
</SlideInner>
</SlideItems>
</SlideGallery>
))}
</Carousel>
<ButtonWrapper>
<PrevButton onClick={ prevSlide } disabled={ index === 0 }><ChevronLeft/></PrevButton>
<NextButton onClick={ nextSlide }><ChevronRigt/></NextButton>
</ButtonWrapper>
解决方案
推荐阅读
- botframework - 机器人中的语音识别问题
- c - 如何在没有引用的情况下更改局部变量
- arrays - 如何将这些值相互绘制?
- reactjs - 无法解析 node_modules 中的 babel 加载器
- node.js - 使用节点js删除mongodb中的特定数据
- c# - 实例化反射委托类型
- javascript - 库是否应该在外部 api 调用上触发事件?
- imageresizer - 处理具有 300dpi 分辨率的 ImageResizer 图像
- pandas - 如何在特定范围内的熊猫中选择 NaN 值
- php - Yii2 PHP 在控制器中使用 beforeAction 执行检查用户