How to do it...

Let's say that you have a list of devices. When you click on a list item, it might take you to a details page for the device. Each device has Bluetooth connectivity that can be toggled on or off. This is a good candidate secondary action to render in the item. Here's the code to do this:

import React, { useState } from 'react';import List from '@material-ui/core/List';import ListItem from '@material-ui/core/ListItem';import ListItemText from '@material-ui/core/ListItemText';import ListItemIcon from '@material-ui/core/ListItemIcon';import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';import IconButton from '@material-ui/core/IconButton';import BluetoothIcon from '@material-ui/icons/Bluetooth';import ...

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.