How to do it...

Let's say that you have a Drawer component with a few items in it. You also have an AppBar component with a menu button and a title. The menu button should toggle the visibility of the drawer, and clicking on a drawer item should update the title in the AppBar. Here's the code to do it:

import React, { useState, Fragment } from 'react';import { withStyles } from '@material-ui/core/styles';import AppBar from '@material-ui/core/AppBar';import Toolbar from '@material-ui/core/Toolbar';import Typography from '@material-ui/core/Typography';import Button from '@material-ui/core/Button';import Drawer from '@material-ui/core/Drawer';import List from '@material-ui/core/List';import ListItem from '@material-ui/core/ListItem';import ListItemIcon ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.