I am a bit stuck here. I am using React bootstrap, Navigation component
I have a route called dashboard. That route is protected, available only via login.
When the user navigates to Dahsboard, this is what I have accomplished:

I would like to achieve something like this:

So when user clicks BOM X-ray it renders small components Children 1,2 and 3.
This is the code that renders first image:
import React from 'react'
import Bom from './bomxray/Indexbom';
import Nav from 'react-bootstrap/lib/Nav';
import NavItem from 'react-bootstrap/lib/NavItem';
import NavDropdown from 'react-bootstrap/lib/NavDropdown';
import MenuItem from 'react-bootstrap/lib/MenuItem';
class Dashboard extends React.Component {
handleSelect(event, selectedKey) {
//event.preventDefault();
alert('selected ' + selectedKey);
}
render() {
return (
<Nav bsStyle="tabs" activeKey={1} onSelect={this.handleSelect}>
<NavItem eventKey={1} >Bom X-Ray</NavItem>
<NavItem eventKey={2} title="Item">Calculation</NavItem>
<NavItem eventKey={3} disabled>NavItem 3 content</NavItem>
<NavDropdown eventKey={4} title="Dropdown" id="nav-dropdown">
<MenuItem eventKey="4.1">Action</MenuItem>
<MenuItem eventKey="4.2">Another action</MenuItem>
<MenuItem eventKey="4.3">Something else here</MenuItem>
<MenuItem divider />
<MenuItem eventKey="4.4">Separated link</MenuItem>
</NavDropdown>
</Nav>
);
}
export default Dashboard
My idea is to create component:
import Bom from './bomxray/Indexbom';
And Bom component will have the Children inside. Those children will be CRUD Ajax to a server.
I tried things like this (FAIL):
<NavItem eventKey={1} <Bom />>Bom X-Ray</NavItem>
And this (renders it, but all is messed up):
<NavItem eventKey={1} >Bom X-Ray</NavItem> <Bom />
If I am on the right track, please some idea how to proceed. If I am on totally wrong track, please point me to right direction :)
EDIT (Added possible solution). Just occured to me, I do have:
handleSelect(event, selectedKey) {
alert('selected ' + selectedKey);
}
Could I somehow dynamicaly render the component? In the handeSelect I catch what ws clicked and based on that render component?
bomcomponents in a separate div outside the nav?