I'm making a dashboard, using React Router v4. I have pages such as Sign up, Sign in, Add and List products, Add and List customers.
Authentication pages, Sign up and Sign in pages are with their own layouts, no, header or footer or nav manu. The rest share the same layout design, with header, nav menu and footer.
I've tried this:
// App.tsx
return (
<Router>
<Route exact path="/" component={Layout}>
<Route exact path="/" component={Status} />
<Route path="/welcome" component={Welcome} />
</Route>
<Route path="/signup" component={SignUp} />
<Route path="/signin" component={SignIn} />
</Router>
);
// Layout.tsx
return (
<React.Fragment>
<Header lastName="Wahaha" />
<Navbar />
{children}
<Footer description="Thanks for visiting!" />
</React.Fragment>
);
<Header />
, <Navbar />
, and <Footer />
are not appeared though.
Took a reference from here: Using multiple layouts for react-router components but it doesn't work for me.
Please help.