React无法识别DOM元素上的“ activeKey”(和“ activeHref”)道具

时间:2018-08-15 03:02:59

标签: reactjs typescript dom

我一直在我的React Web应用程序上不断发出此警告,但不确定如何解决此问题。我对React还是很陌生,并尝试使用谷歌搜索,但仍未找到解决方案。

Warning: React does not recognize the `activeKey` prop on a DOM element. If 
         you intentionally want it to appear in the DOM as a custom 
         attribute, spell it as lowercase `activekey` instead. If you 
         accidentally passed it from a parent component, remove it from the 
         DOM element.
    in div (created by NavbarForm)
    in NavbarForm (created by Header)
    in ul (created by Nav)
    in Nav (created by Header)
    in div (created by Grid)
    in Grid (created by Navbar)
    in nav (created by Navbar)
    in Navbar (created by Uncontrolled(Navbar))
    in Uncontrolled(Navbar) (created by Header)
    in Header (created by App)
    in div (created by App)
    in App

这是我的标题的代码

import * as React from 'react';
import { Button, FormControl, FormGroup, Nav, Navbar, NavItem} from 'react-bootstrap';

const Header = (props : any) => {
    return (
        <Navbar>
            <Navbar.Header>
                <Navbar.Brand>
                    <NavItem href="/">
                        RedQuick
                    </NavItem>
                </Navbar.Brand>
            </Navbar.Header>
            <Nav>
                <Navbar.Form>
                    <form onSubmit={ props.getRedditPost }>
                        <FormGroup>
                            <FormControl 
                                type="text" 
                                name="subreddit" 
                                placeholder="Subreddit Name..." 
                            />
                        </FormGroup>
                        <Button type="submit">Search</Button>
                    </form>
                </Navbar.Form>                
            </Nav>
        </Navbar>
    );
};

export default Header;

Link to Github repo if its not the header's problem

1 个答案:

答案 0 :(得分:1)

一个web search找到了我this issue,这表明将Date Data Transferred (MB) Data Transferred (GB) 146 2018-08-14 08:00:00 1.871237e+05 1.874017e+05 147 2018-08-14 07:55:00 1.123211e+05 1.961854e+05 148 2018-08-14 07:50:00 2.187703e+05 2.187123e+05 ... Total 1.408910e+08 1.408910e+08 放在<Navbar.Form>里面是无效的。查看the documentation中的示例,可能仅删除<Nav>