<img/>标签上的未知道具`active`

时间:2017-07-22 16:23:56

标签: reactjs react-bootstrap

我正在使用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>
    )
    }
}

1 个答案:

答案 0 :(得分:1)

这是一个已知问题,现已关闭。点击此处:issues react-bootstrap

在此日期升级到最新版本v0.31.1

结论:这是一个反应引导问题,因为它是一个警告,你可以忽略它。