April 2020
Intermediate to advanced
716 pages
18h 55m
English
The Menu component will function as a navigation bar across the frontend application by providing links to all the available views, and also by indicating the user's current location in the application.
To implement these navigation bar functionalities, we will use the HOC withRouter from React Router to get access to the history object's properties. The following code in the Menu component adds just the title, the Home icon linked to the root route, and the Users button, which is linked to the '/users' route.
mern-skeleton/client/core/Menu.js:
const Menu = withRouter(({history}) => ( <AppBar position="static"> <Toolbar> <Typography variant="h6" color="inherit"> MERN Skeleton </Typography> <Link to="/"> <IconButton aria-label="Home" ...Read now
Unlock full access