I have 3 main components.
this component render the whole app
import React,{Component} from 'react';
import IndexContent from './components/indexContent';
import IndexHome from './components/IndexHome';
import Root from './components/root';
import {BrowserRouter as Router, Match, Miss} from 'react-router';
class Home extends Component{
return(
<Router>
<div>
<Root />
<Match exactly pattern='/' component={IndexContent}/>
<Match pattern="/indexhome" component={IndexHome}/>
</div>
</Router>
)
};
export default Home;
In this component I have the navBar and the footer and in the {this.props.children} I want that the clicked component will be rendered.
import React,{Component} from 'react';
import NavBar from './NavBar';
import Footer from './footer';
class Root extends Component{
render:function(){
return(
<div>
<NavBar/>
{this.props.children}
<Footer/>
</div>
)
}
};
export default Root;
And I have another component with a Link
import { Link } from 'react-router';
<Link to="/indexhome">Join In</Link>
I try for a week now to get it work. I understand that there is this new version of 'react-router' and the syntax might be a problem.
What am I doing wrong if all I want is that by Default the index page is the {IndexContent} and when clicking the Link the {IndexHome} will be rendered?
the {Root} is a way to let navBar and footer be in all pages

react-routerare you using? 2. you simply want anav-barthat will render the component that the router provides without re:render the "layout" (yourRootcomponent)? - Sagiv b.g