Pause on Hover will pause a snackbar's timeout when the mouse is hovered over it. This is disabled by default. It can be enabled in one of two ways:
pauseOnHover
prop on the SnackbarProvider
for all snackbarspauseOnHover
property on the object passed to createSnackbar
for a specific snackbarimport React from 'react';
import { SnackbarProvider, wrapComponent } from 'react-snackbar-alert';
export default function PauseOnHoverExample() {
return (
<SnackbarProvider pauseOnHover={true}>
<Container />
</SnackbarProvider>
);
}
const Container = wrapComponent(function({ createSnackbar }) {
function showSnackbar() {
createSnackbar({
message: 'Hello Snackbar!'
});
}
return (
<div>
<button onClick={showSnackbar}>Show Snackbar</button>
</div>
);
});