I'm trying to do layouts with react-router.
When my user hits /
I want to render some layout. When my user hits /login
, or /sign_up
I want the layout to render, with the relevant component for /login
or /sign_up
rendered.
Currently, my App.js
looks like this
return (
<div className={className}>
<Route path="/" component={Auth} />
<ModalContainer />
</div>
);
My Auth.js
looks like this
return (
<AuthFrame footerText={footerText} footerClick={footerClick}>
<Route path="/login" component={LoginContainer} />
<Route path="/sign_up" component={SignUpContainer} />
</AuthFrame>
);
So AuthFrame
will get rendered when I hit /
, and then react router looks for login
or sign_up
to render the other containers.
However, when I hit /
, only the AuthFrame
will render.
I would like for /
to be treated as /login
.
How do I achieve this?