警告: validateDOMNesting(...):a不能作为a的子项出现

我正在尝试使用reactstrap中的react-router .In路由页面,我需要为reactstrap使用状态,所以我将路由器从一个变量转换为一个类。我得到这个警告:警告: validateDOMNesting(...):<a> cannot appear as a descendant of <a>.我不知道该怎么办?,我需要使用reactstrap设置路由器导航的样式,所以我按照你下面看到的做了。

有很多原因导致这个方法不起作用:

<NavLink componentClass={Link} href="/contact" to="/contact" active={location.pathname === '/contact'}>anywords</NavLink>
<Navbar  dark id="RouterNavbar" expand="md">
          <NavbarBrand id="NavBrand"href="#x"><ul>(a bunch of li not relevant)</ul></NavbarBrand>
<NavbarToggler id="NavBarToggler"  onClick={this.toggle1.bind(this)}  />
          <Collapse  isOpen={this.state.isOpen1}  navbar>
            <Nav   className="ml-auto"  navbar>
            <NavItem>
                <NavLink href="#x"><Link id="RouterNavLink" style={None} to="/contact">anywords</Link></NavLink>
              </NavItem>
(then just more of the above)

除了几个li在任意时间彼此靠近,我有时不得不刷新页面而不是正常行为(自动刷新)和控制台中收到的警告消息外,没有什么不好的事情发生,但当我读到这个问题时,我发现我不应该这么做。

转载请注明出处:http://www.fdzxgo.com/article/20230526/1187009.html