Created
February 18, 2020 13:35
-
-
Save ac205/5d775235a51fa5cf21942b167c1eddbc to your computer and use it in GitHub Desktop.
React Router Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ReactTransactAdmin = ({ match }) => ( | |
<div> | |
<AdminAppbar /> | |
<AdminMenu /> | |
<Route path={match.url} exact component={AdminPanel} /> | |
<Route path={match.url + "/HeroImages"} component={HeroImages} /> | |
<Route path={match.url + "/features"} component={Features} /> | |
<Route path={match.url + "/salebar"} component={SaleBar} /> | |
<Route path={match.url + "/categories"} component={Categories} /> | |
<Route path={match.url + "/products"} component={Products} /> | |
<Route path={match.url + "/add-product"} component={AddProduct} /> | |
</div> | |
); | |
const ReactTransact = ({ match }) => ( | |
<div> | |
<Navbar /> | |
<Menubar /> | |
<MobileMenu /> | |
<Route path={match.url} exact component={Home} /> | |
<Route | |
path={match.url + "product-details/:name"} | |
component={ProductDetail} | |
/> | |
<Route path={match.url + "cart"} component={Cart} /> | |
<Route path={match.url + "contact"} component={Contact} /> | |
<Route path={match.url + "about"} component={About} /> | |
<Route path={match.url + "profile"} component={Profile} /> | |
<Route path={match.url + "shop"} component={Shop} /> | |
<Footer /> | |
</div> | |
); | |
return ( | |
<Router> | |
<Switch> | |
<Route path="/admin" component={ReactTransactAdmin} /> | |
<Route path="/" component={ReactTransact} /> | |
</Switch> | |
</Router> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment