@mindk/react-material-loader
v1.0.1
Published
[Notistack](https://github.com/iamhosseindhv/notistack) with PubSub
Downloads
2
Keywords
Readme
react-material-snackbars
Notistack with PubSub
Docs
Installation
Install via npm
npm install --save @mindk/react-material-snackbars
Quick Example
1: Wrap your app inside a SnackbarProvider
component: (see docs for a full list of available props)
Note: If you're using material-ui ThemeProvider
, make sure SnackbarProvider
is a child of it.
import SnackbarProvider from '@mindk/react-material-snackbars';
<SnackbarProvider>
<App />
</SnackbarProvider>;
2: Send notifications in any files you need.
import React from 'react';
import { success, warning, info, error, notification } from '../.';
export default function SnackbarsDemo() {
return (
<div>
<button type="button" onClick={() => success('Success message')}>
Success
</button>
<button type="button" onClick={() => info('Info message')}>
Info
</button>
<button type="button" onClick={() => warning('Warning message')}>
Warning
</button>
<button type="button" onClick={() => error('Error message')}>
Error
</button>
<button type="button" onClick={() => notification('Custom message')}>
Custom
</button>
</div>
);
}