rns-redux
v4.1.1
Published
A reimagining of React-Notification-System in Typescript, with an API that supports React Hooks.
Downloads
9
Readme
RNS Redux
A reimagining of React-Notification-System in Typescript, with an API that supports React Hooks.
Github: https://github.com/justindujardin/rns-redux/
Website: https://justindujardin.github.io/rns-redux/
Project Health
| Check Type | Status | | ------------- | ------------- | | Master Build | | | Code Coverage | | | Dependency Updater | | | Up-to-date Dependencies | | | Up-to-date DevDependencies | | | Contributors | |
Usage
Install the library:
npm install --save rns-redux
Add the NotifyProvider
near the top of your app. By default this will include a component NotifyPortal
as a child that will render the notifications. This can be disabled if the NotifyPortal is manually placed elsewhere.
<NotifyProvider>
<YourApp/>
</NotifyProvider>
Under the covers React's useReducer
API is the default store for notifications state, which is local to the provider component instance.
Show a notification:
export function MyHookComponent() {
const { api } = useNotify()
api.showNotification({
level: 'info',
message: 'hi'
})
}
Credits
Typescript library starter by @alexjoverm
React Components based on React-Notification-System
Thanks to the wonderful people that contribute to this project (emoji key):
| Justin DuJardin⚠️ 💻 🚇 | Alex Jover🚇 | | :---: | :---: |
This project follows the all-contributors specification. Contributions of any kind welcome!