2016-03-31 22 views
0

これはMake Twitter Bootstrap navbar work like tabsに関連しています。しかし、私はこれをReactで動作させようとしています。 基本的には、Nav Barにタブを表示したいと思います。それを行う簡単な方法はありますか? NavItemの代わりに
http://react-bootstrap.github.io/components.html#navigationReact Bootstrap Navbarのタブ

<Navbar> 
    <Navbar.Header> 
    <Navbar.Brand> 
     <a href="#">React-Bootstrap</a> 
    </Navbar.Brand> 
    </Navbar.Header> 
    <Nav> 
    <NavItem eventKey={1} href="#">Link</NavItem> 
    <NavItem eventKey={2} href="#">Link</NavItem> 
    </Nav> 
</Navbar> 

、私は <Tab eventKey={1} title="Tab 1">Tab 1 content</Tab>

答えて

0

を使用することができるだけで

constructor(state) { 
     super(state); 
     this.state = { 
      activeKey: 1 
     }; 
    } 

    handleSelect(eventKey) { 
     this.setState({ 
      activeKey: eventKey 
     }); 
    } 

render() { 

     <Nav bsStyle="tabs" activeKey={this.state.activeKey} 
     onSelect={this.handleSelect.bind(this)}> 

     <...> 
     } 

の代わり<Nav>を使用し、それが仕事をします。 Docs

関連する問題