Advertisement
Guest User

Untitled

a guest
May 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import React from "react";
  2. import { BrowserRouter as Router, Route } from "react-router-dom";
  3.  
  4. import routes from "./routes";
  5. import withTracker from "./withTracker";
  6.  
  7. import "bootstrap/dist/css/bootstrap.min.css";
  8. import "./shards-dashboard/styles/shards-dashboards.1.1.0.min.css";
  9.  
  10. import { DefaultLayout } from "./layouts";
  11.  
  12. // This acts as the 404 Error route component.
  13. const NoMatch = () => {
  14. return <DefaultLayout>
  15. <p>Nothing found</p>
  16. </DefaultLayout>
  17. }
  18.  
  19. export default () => (
  20. <Router basename={process.env.REACT_APP_BASENAME || ""}>
  21. <div>
  22. {routes.map((route, index) => {
  23. return (
  24. <Route
  25. key={index}
  26. path={route.path}
  27. exact={route.exact}
  28. component={withTracker(props => {
  29. return (
  30. <route.layout {...props}>
  31. <route.component {...props} />
  32. </route.layout>
  33. );
  34. })}
  35. />
  36. );
  37. })}
  38. <Route component={NoMatch} /> {/* Make sure to register it at the bottom */}
  39. </div>
  40. </Router>
  41. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement