March 2019
Intermediate to advanced
534 pages
14h 52m
English
Let's say that you're using react-router in your application to control the navigation from one screen to another, and you would like to use a Menu component to render links. Here's an example that shows how to do this:
import React, { Fragment, useState } from 'react';import { Switch, Route, Link } from 'react-router-dom';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 Typography from '@material-ui/core/Typography';import MenuIcon from '@material-ui/icons/Menu';const NavMenuItem = ({ color, ...props }) => ( <Switch> <Route exact path={props.to} render={() => <MenuItem selected component={Link} ...Read now
Unlock full access