March 2019
Intermediate to advanced
534 pages
14h 52m
English
Let's say that you want a simple button in your snackbar that closes the snackbar. This could be useful for closing the snackbar before it automatically closes. Alternatively, you might want to require the user to explicitly acknowledge the message by having to close it manually. Here's the code to add a close button to a Snackbar component:
import React, { Fragment, useState } from 'react';import { Route, Link } from 'react-router-dom';import Snackbar from '@material-ui/core/Snackbar';import Button from '@material-ui/core/Button';import IconButton from '@material-ui/core/IconButton';import Typography from '@material-ui/core/Typography';import CloseIcon from '@material-ui/icons/Close';export default function Snackbars() { ...Read now
Unlock full access