How to have default collapsed Navbar with Reactstrap?

2.8k Views Asked by At

I'm using reactstrap impimentation of bootstrap4 on a node application. Its my first time and I need a little help. How do I make the navbar collapsed all the time (regardless of screen size)? Here's example code from reactstrap github page:

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>
)}
1

There are 1 best solutions below

0
On

This might help.

There's an example in the documentation. https://reactstrap.github.io/components/navbar/

render() { return ( reactstrap Components Github );