npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-smart-alert

v1.0.10

Published

Universal smart alert system for React & React Native with support for Redux Toolkit, traditional Redux, Context API, and auto fallback.

Readme

⚡️ react-smart-alert

A universal, cross-platform alert system for React and React Native.
Supports:

✅ Redux Toolkit
✅ Traditional Redux
✅ Context API
✅ No state setup (auto fallback)
✅ Web & React Native
✅ Custom CSS support


🚀 Installation

npm install react-smart-alert

If not already installed, also add:

npm install react react-redux @reduxjs/toolkit

📦 Features Works with React AND React Native

Supports Redux Toolkit ✅

Supports Traditional Redux ✅

Supports Context API ✅

Works even without Redux/Context (auto fallback) ✅

Customizable styling ✅

  1. Wrap Your App
import { AlertProvider, Alert } from 'react-smart-alert';

<AlertProvider>
  <Alert />
  <YourApp />
</AlertProvider>
  1. Use Hook Anywhere
import { useAlert } from 'react-smart-alert';

const Component = () => {
  const alert = useAlert();

  return <button onClick={() => alert('Hello World!', 'success')}>Show Alert</button>;
};

🔁 Usage with Redux Toolkit

  1. Configure Store
import { configureStore } from '@reduxjs/toolkit';
import { alertReducer } from 'react-smart-alert';

export const store = configureStore({
  reducer: {
    alert: alertReducer,
  },
});
  1. Wrap App in Redux Provider
import { Provider } from 'react-redux';
import { Alert } from 'react-smart-alert';

<Provider store={store}>
  <Alert />
  <YourApp />
</Provider>

🔁 Usage with Traditional Redux

  1. Setup Reducer
import { createStore, combineReducers } from 'redux';
import { createAlertReducer } from 'react-smart-alert';

const rootReducer = combineReducers({
  alert: createAlertReducer(),
});

const store = createStore(rootReducer);
  1. Same: Wrap App with and use 📱 React Native Support React Native support is built-in. Use exactly like web version:
import { AlertProvider, Alert, useAlert } from 'react-smart-alert';

<AlertProvider>
  <Alert />
  <YourScreen />
</AlertProvider>
const MyScreen = () => {
  const alert = useAlert();
  return <Button title="Show" onPress={() => alert('React Native Alert', 'info')} />;
};

🎨 Custom Styling (Web Only)

<Alert className="custom-alert" />

Or override default CSS:

.alert-success {
  background-color: #28a745 !important;
}

📋 Alert Types Type Description info General info or notice success Success messages warning Risky actions, confirmations error Failures, validation errors ⏱ Custom Duration

alert("This will stay for 5 seconds", "info", 5000);

⚙️ Fallback (Zero Config Usage) No Redux or Context? No problem:

import { InternalAlertProvider, Alert, useAlert } from 'react-smart-alert';

<InternalAlertProvider>
  <Alert />
  <App />
</InternalAlertProvider>

🛠 API Reference useAlert(message, type?, duration?) Param Type Default Description message string required The alert message type string info One of: info, success, warning, error duration number 3000 Duration in ms before hiding 🧑‍💻 Author Made with ❤️ by Rohit

🪪 License MIT License