How to do it...

Let's say that your screen has two selects—a category select and a product select. Initially, only the category select is populated and enabled. The product select depends on the category select—once a category is selected, the product select is enabled and populated with the appropriate products. Here's the code to do this:

import React, { Fragment, useState } from 'react';import { makeStyles } from '@material-ui/styles';import InputLabel from '@material-ui/core/InputLabel';import MenuItem from '@material-ui/core/MenuItem';import FormHelperText from '@material-ui/core/FormHelperText';import FormControl from '@material-ui/core/FormControl';import Select from '@material-ui/core/Select';const useStyles = makeStyles(theme => ...

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.