我正在使用Carousel from react-bootstrap,所以每当img的任何人的班级active
时,js都会向我发出警告
Unknown prop `active` on <img> tag. Remove this prop from the element. For details, see ...
in img (at nav.js:13)
in LinkContainer (at nav.js:12)
in div (at nav.js:10)
in Navigation (at app.js:15)
in div (at app.js:13)
in App (created by RouterContext)
in RouterContext (created by Router)
in Router (at routes.js:8)
in div (at index.js:13)
我认为不需要任何文件,因为它看起来像是react-bootstrap本身的设计错误,但这里是Carousel文件
import React, {Component} from "react";
import {Carousel} from "react-bootstrap";
import img1 from "./images/Screenshot (1).jpg";
import img2 from "./images/Screenshot (2).jpg";
import img3 from "./images/Screenshot (3).jpg";
import "./carousel.css";
export default class Slideshow extends Component {
render() {
return (
<div>
<Carousel pauseOnHover={true} interval={3000}>
<Carousel.Item>
<img className="slide-image" alt="900x500" src={img1}/>
<Carousel.Caption>
<h3>First slide label</h3>
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img className="slide-image" alt="900x500" src={img2}/>
<Carousel.Caption>
<h3>Second slide label</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img className="slide-image" alt="900x500" src={img3}/>
<Carousel.Caption>
<h3>Third slide label</h3>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
</Carousel.Caption>
</Carousel.Item>
</Carousel>
</div>
)
}
}
答案 0 :(得分:1)