There's more...

When the items in your drawer are links, you probably want a visual indication for the active link. The challenge is that you want to style the active link using Material-UI theme styles. Here's what the modified example looks like:

import React, { useState } from 'react';import clsx from 'clsx';import { Switch, Route, Link, NavLink } from 'react-router-dom';import { withStyles } from '@material-ui/core/styles';import Drawer from '@material-ui/core/Drawer';import Grid from '@material-ui/core/Grid';import Button from '@material-ui/core/Button';import List from '@material-ui/core/List';import ListItem from '@material-ui/core/ListItem';import ListItemIcon from '@material-ui/core/ListItemIcon';import ListItemText from '@material-ui/core/ListItemText'; ...

Get React Material-UI Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.