I am having some issues with react routes and not sure what is the appropriate way to accomplish what I am trying.
I read in react router v4 parents should render their children so I have something like this
<Switch>
<Route exact path='/' component={FrontEndContainer} />
<Route exact path='/dashboard' component={AuthContainer}>
<Route exact path='/login' component={LoginPage} />
</Switch>
const FrontEndContainer = () => {
return (
<div>
<Navigation />
<main>
<Header />
<Route exact path='/' component={HomePage} />
<Route path='/about' component={AboutPage} />
<Route path='/contact' component={ContactPage} />
</main>
<Footer />
</div>
);
};
export default FrontEndContainer;
This works if you navigate to http://example.com but when you try and navigate to http://example.com/about does not render. I realize its because of the exact but if I don't have the exact, when you navigate to http://example.com/login the FrontEndContainer is rendered without the inner components and the login page.
My goal is that when the user navigates to the login page, the FrontEndContainer is not rendered and when the navigate to / or /about the FrontEndContainer is rendered and the inner containers.
I feel I am missing something very simple...
Thanks in advance for pointing out the mistake!