@splunk/react-toast-notifications
A package for creating toast notifications in a React application.
Install
Install the package and its dependencies.
- Install the peer dependencies:
npm install react@^16 styled-components@^5
- Install the package:
npm install @splunk/react-toast-notifications
Usage
Only import these once. See Usage for details.
import ToastMessages from '@splunk/react-toast-notifications/ToastMessages';
import Toaster, { makeCreateToast } from '@splunk/react-toast-notifications/Toaster';
import { TOAST_TYPES } from '@splunk/react-toast-notifications/ToastConstants';
Production builds
Both @splunk/react-toast-notifications
and React support production and development builds. The production build removes warnings and guidance from the output. To create a production build, set the environment variable NODE_ENV
to "production"
and use the webpack DefinePlugin to inject the variable into the code.