How to create a custom page
Here is the example on how to create your own page and add it to the left side menu and breadcrumbs.
-
Create page component
src/app/pages/home/MyPage.js
import React from "react"; export default function MyPage() { return <h1>Hello!</h1> }
-
Update
src/app/pages/home/HomePage.js
import React from "react"; import { Redirect, Route, Switch } from "react-router-dom"; import Builder from "./Builder"; import Dashboard from "./Dashboard"; import GoogleMaterialPage from "./google-material/GoogleMaterialPage"; + import MyPage from "./MyPage"; export default function HomePage() { return ( <Switch> { /* Redirect from root url to /dashboard. */ <Redirect exact={true} from="/" to="/dashboard" /> } <Route path="/builder" component={Builder} /> <Route path="/dashboard" component={Dashboard} /> <Route path="/google-material" component={GoogleMaterialPage} /> + <Route path="/my-page" component={MyPage} /> </Switch> ); }
-
Register page in
src/_metronic/layouts/demo1/MenuConfig.js
aside: { self: {}, items: [ { title: "Dashboard", root: true, icon: "flaticon2-architecture-and-city", page: "dashboard", translate: "MENU.DASHBOARD", bullet: "dot" }, + { + title: 'My Page', // <= Title of the page + desc: 'Some my description goes here', // <= Description of the page + root: true, + page: 'my-page', // <= URL + icon: 'flaticon-line-graph' // <= Choose the icon + },
