Let's say that, instead of creating a component that abstracts a group of Checkbox components, you you want want to do the same thing with the Switch components. Here's the code:
import React, { Fragment, useState } from 'react';import FormLabel from '@material-ui/core/FormLabel';import FormControl from '@material-ui/core/FormControl';import FormGroup from '@material-ui/core/FormGroup';import FormControlLabel from '@material-ui/core/FormControlLabel';import FormHelperText from '@material-ui/core/FormHelperText';import Switch from '@material-ui/core/Switch';const SwitchGroup = ({ values, label, onChange }) => ( <FormControl component="fieldset"> <FormLabel component="legend">{label}</FormLabel> <FormGroup> {values.map((value, ...