React无法识别DOM元素上的“ activeKey”(和“ activeHref”)道具 [英] React does not recognize the 'activeKey' (and 'activeHref') prop on a DOM element
本文介绍了React无法识别DOM元素上的“ activeKey”(和“ activeHref”)道具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在我的React Web应用程序上收到此警告,并且不确定如何解决此问题。我对React还是很陌生,并尝试过使用Google搜索的方式,但是仍然没有找到解决方案。
I've been continuously having this warning on my React web application and not sure how I can fix this. I'm pretty new to React and have tried googling my way through, but still haven't ended up in a solution.
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;
推荐答案
A <一个href = https://www.google.com/search?q=activeKey+activeHref rel = nofollow noreferrer>网络搜索找到了我此问题,表示放置< Navbar.Form>
< Nav>
内的无效。查看文档中的示例,它可能只适用于删除< Nav>
。
A web search found me this issue, which indicates that putting <Navbar.Form>
inside <Nav>
is not valid. Looking at the example in the documentation, it may work to just remove the <Nav>
.
这篇关于React无法识别DOM元素上的“ activeKey”(和“ activeHref”)道具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文