Notistack code example
Example 1: Notistack
import { useSnackbar } from 'notistack';
const MyButton = () => {
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
const handleClick = () => {
enqueueSnackbar('I love hooks');
};
return (
);
}
Example 2: notistack
// on connection loss
const key = props.enqueueSnackbar('No connection!', {
variant: 'error',
persist: true,
});
// when we're back online
props.closeSnackbar(key);