React Snackbar Alert is a very simple library for "snackbar" style notifications. It's a quick and lightweight way to let your users know what's going on in your app.
import React from 'react';
import { SnackbarProvider, wrapComponent } from 'react-snackbar-alert';
export default function DemoExample() {
return (
<SnackbarProvider position="bottom">
<Container />
</SnackbarProvider>
);
}
const Container = wrapComponent(function({ createSnackbar }) {
function showSnackbar() {
createSnackbar({
message: 'Hello Snackbar!',
dismissable: false,
pauseOnHover: false,
progressBar: true,
sticky: false,
theme: 'default',
timeout: 3000
});
}
return (
<div>
<button onClick={showSnackbar}>Show Snackbar</button>
</div>
);
});
React Snackbar Alert requires React 16.8 or newer. It also requires styled-components 4 to be installed.