March 2019
Intermediate to advanced
534 pages
14h 52m
English
Let's say that a component in your application has a menu button that, when clicked, displays a menu with several options in it. The options could change based on other pieces of state in the application, such as permissions, or the state of another resource. Here's the source to build this component:
import React, { Fragment, useState } from 'react';import { makeStyles } from '@material-ui/styles';import Button from '@material-ui/core/Button';import Menu from '@material-ui/core/Menu';import MenuItem from '@material-ui/core/MenuItem';import MenuIcon from '@material-ui/icons/Menu';const useStyles = makeStyles(theme => ({ rightIcon: { marginLeft: theme.spacing(1) }}));export default function ComposingMenusWithState() { const ...Read now
Unlock full access