Skip to content

Instantly share code, notes, and snippets.

@Lumbe
Created June 30, 2017 14:42
Show Gist options
  • Save Lumbe/97fe1f1da2794e73e9f3ce32d544f1cd to your computer and use it in GitHub Desktop.
Save Lumbe/97fe1f1da2794e73e9f3ce32d544f1cd to your computer and use it in GitHub Desktop.
react-bootstrap navigation menu with react-router-dom through react-router-bootstrap library

Use navigation menu from react-bootstrap library with react-router-dom library using from react-router-bootstrap library

Example:

import { Route, RouteHandler, Link } from 'react-router';
import AuthService from '../services/AuthService'
import { Button, Nav, Navbar, NavDropdown, MenuItem, NavItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';

/// In the render() method
<Nav pullRight>
  <LinkContainer to="/home">
    <NavItem eventKey={1}>Home</NavItem>
  </LinkContainer>
  <LinkContainer to="/book">
    <NavItem eventKey={2}>Book Inv</NavItem>
  </LinkContainer>
  <NavDropdown eventKey={3} title="Authorization" id="basic-nav-dropdown">
    <LinkContainer to="/logout">
      <MenuItem eventKey={3.1}>Logout</MenuItem>    
    </LinkContainer>      
  </NavDropdown>  
</Nav>

source: https://stackoverflow.com/a/36933127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment