单击时,reactstrap Navbar 不发表意见或折叠
reactstrap Navbar not opining or collapsing when clicked
我已经在 React 中实现了 reactstrap 导航栏,它可以正常工作,但折叠按钮不是 opening/closing
这是我的代码:
<Navbar color="light" expand="md" light>
<NavbarBrand href="/">QIFF DASHBOARD</NavbarBrand>
<NavbarToggler onClick={function noRefCheck() {}} />
<Collapse navbar>
<Nav navbar>{createLinks(routes)}</Nav>
</Collapse>
<NavbarText onClick={handleLogout}>Logout</NavbarText>
</Navbar>
试试这个
class App extends Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
isOpen: false
};
}
toggle() {
this.setState({
isOpen: !this.state.isOpen
});
render() {
return (
<Navbar color="inverse" inverse toggleable>
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand href="/">reactstrap</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
)}
`
我已经在 React 中实现了 reactstrap 导航栏,它可以正常工作,但折叠按钮不是 opening/closing
这是我的代码:
<Navbar color="light" expand="md" light>
<NavbarBrand href="/">QIFF DASHBOARD</NavbarBrand>
<NavbarToggler onClick={function noRefCheck() {}} />
<Collapse navbar>
<Nav navbar>{createLinks(routes)}</Nav>
</Collapse>
<NavbarText onClick={handleLogout}>Logout</NavbarText>
</Navbar>
试试这个
class App extends Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
isOpen: false
};
}
toggle() {
this.setState({
isOpen: !this.state.isOpen
});
render() {
return (
<Navbar color="inverse" inverse toggleable>
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand href="/">reactstrap</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
)}
`