navs-notistack
v1.0.1
Published
A simple and customizable React notification system
Downloads
6
Maintainers
Readme
navs-notistack
A simple, lightweight and customizable notification system for React applications.
Installation
npm install navs-notistack
# or
yarn add navs-notistackUsage
Basic Usage
import notification from 'navs-notistack';
// Show a success notification
notification.showSuccess('Operation completed successfully!');
// Show an error notification
notification.showError('Something went wrong!');With Wrapper Component
import React from 'react';
import { NotificationWrapper } from 'navs-notistack';
import notification from 'navs-notistack';
function App() {
const handleClick = () => {
notification.showSuccess('Button clicked!');
};
return (
<NotificationWrapper>
<div>
<h1>My App</h1>
<button onClick={handleClick}>Show Notification</button>
</div>
</NotificationWrapper>
);
}API
notification.showSuccess(message)
Shows a success notification with the given message.
notification.showError(message)
Shows an error notification with the given message.
notification.init()
Initializes the notification system. This is automatically called when you use the NotificationWrapper component.
License
MIT
