Top Related Projects
React notification made easy 🚀 !
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
🍞 A toast notification system for react
Smoking Hot React Notifications 🔥
Delightful and highly customisable React Component to notify your users
A beautiful replacement for JavaScript's "alert"
Quick Overview
Reapop is a React notification system that provides a simple and customizable way to display notifications in your React applications. It offers a wide range of features, including support for different notification types, custom styling, and advanced configuration options.
Pros
- Customizable: Reapop allows you to customize the appearance and behavior of notifications to fit your application's design and requirements.
- Flexible: The library supports various notification types, such as success, error, warning, and info, and provides options to control the duration, position, and animation of notifications.
- Easy to Integrate: Reapop is designed to be easily integrated into existing React projects, with a straightforward API and clear documentation.
- Responsive: The library is designed to be responsive and works well on both desktop and mobile devices.
Cons
- Dependency on React: Reapop is a React-specific library, which means it may not be suitable for non-React projects.
- Limited Functionality: While Reapop provides a good set of features, it may not have all the functionality that some developers might need, such as advanced notification management or integration with other libraries.
- Potential Performance Issues: Depending on the number and complexity of notifications, Reapop may have some performance implications, especially in large-scale applications.
- Limited Community Support: Compared to some other popular React libraries, Reapop has a relatively small community, which may limit the availability of third-party plugins or extensions.
Code Examples
Here are a few examples of how to use Reapop in your React application:
- Displaying a Notification:
import React from 'react';
import { useNotification } from 'reapop';
const MyComponent = () => {
const { notify } = useNotification();
const showNotification = () => {
notify({
title: 'Success',
message: 'Your action was successful!',
status: 'success',
position: 'top-right',
dismissible: true,
dismissAfter: 3000,
});
};
return (
<button onClick={showNotification}>
Show Notification
</button>
);
};
- Customizing Notification Styles:
import React from 'react';
import { useNotification } from 'reapop';
const MyComponent = () => {
const { notify } = useNotification();
const showNotification = () => {
notify({
title: 'Warning',
message: 'Something went wrong!',
status: 'warning',
position: 'top-center',
dismissible: true,
dismissAfter: 5000,
style: {
backgroundColor: '#ffa500',
color: '#fff',
padding: '16px 24px',
borderRadius: '4px',
},
});
};
return (
<button onClick={showNotification}>
Show Customized Notification
</button>
);
};
- Handling Notification Dismissal:
import React, { useState } from 'react';
import { useNotification } from 'reapop';
const MyComponent = () => {
const { notify, dismissNotification } = useNotification();
const [notificationId, setNotificationId] = useState(null);
const showNotification = () => {
const id = notify({
title: 'Info',
message: 'This notification can be dismissed manually.',
status: 'info',
position: 'bottom-right',
dismissible: true,
dismissAfter: 0,
});
setNotificationId(id);
};
const handleDismiss = () => {
dismissNotification(notificationId);
};
return (
<div>
<button onClick={showNotification}>
Show Dismissible Notification
</button>
<button onClick={handleDismiss}>
Dismiss Notification
</button>
</div>
);
};
Getting Started
To get started with Reapop
Competitor Comparisons
React notification made easy 🚀 !
Pros of react-toastify
- More lightweight and focused solely on toast notifications
- Easier to set up and use with less configuration required
- Better documentation and examples
Cons of react-toastify
- Less customizable than reapop
- Fewer built-in animation options
- Limited support for complex notification structures
Code Comparison
reapop:
import { setUpNotifications, notify } from 'reapop'
setUpNotifications({
defaultProps: { position: 'top-right', dismissible: true }
})
notify('Hello World!', 'success')
react-toastify:
import { ToastContainer, toast } from 'react-toastify'
<ToastContainer position="top-right" autoClose={5000} />
toast.success('Hello World!')
Both libraries offer simple ways to create toast notifications, but react-toastify's API is slightly more concise. reapop requires an initial setup step, while react-toastify can be used immediately after importing. However, reapop's setup allows for more global configuration options.
react-toastify is generally easier to get started with and has a more straightforward API, making it a popular choice for simple notification needs. reapop, on the other hand, offers more advanced features and customization options, which can be beneficial for complex applications with specific notification requirements.
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
Pros of notistack
- Seamless integration with Material-UI, making it ideal for React projects using this UI library
- Supports stacking multiple notifications with customizable positioning
- Offers a simpler API with less configuration required out of the box
Cons of notistack
- Limited to Material-UI ecosystem, which may not be suitable for all projects
- Fewer customization options compared to reapop's extensive theming capabilities
- Lacks some advanced features like notification groups or custom animations
Code Comparison
notistack:
import { useSnackbar } from 'notistack';
const { enqueueSnackbar } = useSnackbar();
enqueueSnackbar('This is a success message!', { variant: 'success' });
reapop:
import { notify } from 'reapop';
notify('This is a success message!', {
status: 'success',
dismissible: true,
dismissAfter: 3000
});
Both libraries offer straightforward ways to display notifications, but reapop provides more granular control over notification behavior in its basic implementation. notistack's API is more concise, leveraging React hooks for a clean integration within components.
🍞 A toast notification system for react
Pros of react-toast-notifications
- Simpler API with fewer configuration options, making it easier to get started
- Lightweight package with minimal dependencies
- Built-in support for custom components, allowing for greater flexibility
Cons of react-toast-notifications
- Less customizable out of the box compared to reapop
- Fewer animation options and less control over positioning
- Limited built-in themes and styling options
Code Comparison
react-toast-notifications:
import { useToasts } from 'react-toast-notifications'
const { addToast } = useToasts()
addToast('This is a toast message', { appearance: 'success' })
reapop:
import { notify } from 'reapop'
notify('This is a toast message', {
status: 'success',
position: 'top-right',
dismissAfter: 3000
})
Both libraries offer straightforward ways to create toast notifications, but reapop provides more configuration options in the notification creation call. react-toast-notifications uses a hook-based approach, while reapop uses a more traditional function call.
react-toast-notifications is a good choice for projects that need a simple, lightweight toast solution with easy customization of components. reapop is better suited for applications requiring more advanced features, extensive customization options, and finer control over notification behavior and appearance.
Smoking Hot React Notifications 🔥
Pros of react-hot-toast
- Lightweight and minimalistic design, focusing on simplicity
- Customizable toast positioning and animations
- Easy integration with React projects
Cons of react-hot-toast
- Limited built-in notification types compared to reapop
- Fewer advanced features like progress bars or custom actions
- Less flexibility in terms of styling and theming options
Code Comparison
react-hot-toast:
import { toast } from 'react-hot-toast';
toast('Hello World');
toast.success('Successfully created!');
toast.error('This is an error!');
reapop:
import { notify } from 'reapop';
notify('Hello World');
notify('Successfully created!', 'success');
notify('This is an error!', 'error');
Both libraries offer simple APIs for creating notifications, but reapop provides more options for customization and advanced features. react-hot-toast focuses on a streamlined approach with fewer configuration options, making it easier to get started quickly. reapop offers more flexibility in terms of notification types, themes, and advanced features like progress bars and custom actions, but may require more setup and configuration. The choice between the two depends on the specific needs of your project and the level of customization required.
Delightful and highly customisable React Component to notify your users
Pros of react-notifications-component
- More customizable appearance with CSS-in-JS styling
- Supports animations and custom transitions
- Offers a wider variety of notification types (e.g., async, custom content)
Cons of react-notifications-component
- Less opinionated design, requiring more setup for basic use cases
- Documentation could be more comprehensive
- Fewer built-in themes compared to reapop
Code Comparison
react-notifications-component:
import { Store } from "react-notifications-component";
Store.addNotification({
title: "Wonderful!",
message: "teodosii@react-notifications-component",
type: "success",
insert: "top",
container: "top-right",
animationIn: ["animate__animated", "animate__fadeIn"],
animationOut: ["animate__animated", "animate__fadeOut"],
dismiss: {
duration: 5000,
onScreen: true
}
});
reapop:
import { notify } from 'reapop'
notify('Welcome to reapop!', {
title: 'Welcome',
status: 'success',
dismissible: true,
dismissAfter: 3000
})
Both libraries offer React-based notification systems, but react-notifications-component provides more flexibility in styling and animation at the cost of a slightly more complex API. reapop, on the other hand, offers a simpler, more opinionated approach that may be quicker to implement for basic use cases.
A beautiful replacement for JavaScript's "alert"
Pros of sweetalert
- Simpler API and easier to use for basic alert scenarios
- More visually appealing out-of-the-box design
- Smaller bundle size, suitable for lightweight projects
Cons of sweetalert
- Less customizable compared to reapop's extensive options
- Limited to modal-style alerts, while reapop offers various notification types
- Lacks advanced features like notification queuing and positioning
Code Comparison
sweetalert:
swal({
title: "Good job!",
text: "You clicked the button!",
icon: "success",
button: "Aww yiss!",
});
reapop:
notify({
title: 'Good job!',
message: 'You clicked the button!',
status: 'success',
dismissible: true,
dismissAfter: 3000,
position: 'top-right'
});
Both libraries offer simple ways to create notifications, but reapop provides more configuration options out of the box. sweetalert focuses on modal-style alerts with a straightforward API, while reapop allows for more diverse notification types and placements. The choice between the two depends on the specific needs of your project, with sweetalert being ideal for simple use cases and reapop offering more flexibility for complex notification systems.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Reapop
A simple and customizable React notifications system
Summary
Compatibility
Supported browsers
![]() IE / Edge | ![]() Firefox | ![]() Chrome | ![]() Safari | ![]() Opera |
---|---|---|---|---|
IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
Demo
Check out the demo.
Installation
npm install reapop --save
Integration & usage
With React and Redux
1 - Add the notifications reducer to your Redux store.
import {combineReducers, createStore} from 'redux'
import {reducer as notificationsReducer} from 'reapop'
const rootReducer = combineReducers({
notifications: notificationsReducer(),
... your other reducers
})
const store = createStore(rootReducer)
2 - Add the NotificationsSystem
component to your app. Place this component at the root of your application to avoid position conflicts.
import React from 'react'
import {useDispatch, useSelector} from 'react-redux'
import NotificationsSystem, {atalhoTheme, dismissNotification} from 'reapop'
const ATopLevelComponent = () => {
const dispatch = useDispatch();
// 1. Retrieve the notifications to display.
const notifications = useSelector((state) => state.notifications)
return (
<div>
<NotificationsSystem
// 2. Pass the notifications you want Reapop to display.
notifications={notifications}
// 3. Pass the function used to dismiss a notification.
dismissNotification={(id) => dispatch(dismissNotification(id))}
// 4. Pass a builtIn theme or a custom theme.
theme={atalhoTheme}
/>
</div>
)
}
3 - Set default notifications attributes
import {setUpNotifications} from 'reapop'
// run this function when your application starts before creating any notifications
setUpNotifications({
defaultProps: {
position: 'top-right',
dismissible: true
}
})
4 - Upsert or dismiss notification from any React components.
import React from 'react'
import {useDispatch} from 'react-redux'
// 1. Retrieve the action to create/update a notification, or any other actions.
import {notify} from 'reapop'
const AComponent = () => {
// 2. Retrieve the function to dispatch an action.
const dispatch = useDispatch()
useEffect(() => {
// 3. Create a notification.
dispatch(notify('Welcome to the documentation', 'info'))
}, [])
return (
...
)
}
5 - Upsert or dismiss notification from Redux actions.
// 1. Retrieve the action to create/update a notification.
import {notify} from 'reapop'
const sendResetPasswordLink = () => (dispatch) => {
axios.post('https://api.example.com/users/ask-reset-password')
// 2. Create a notification.
.then((resp) => dispatch(notify(resp.data.detail, 'success'))
.catch((resp) => dispatch(notify(resp.data.detail, 'error'))
}
}
With React alone (react >= 16.8.0)
1 - Add the NotificationsProvider
at the root of your application.
It is important that this component wraps all the components
where you want to access the notifications and the actions to manipule notifications.
import React from 'react'
import {NotificationsProvider} from 'reapop'
const ARootComponent = () => {
return (
<NotificationsProvider>
// ... components
</NotificationsProvider>
)
}
2 - Add the NotificationsSystem
component to your app. Place this component at the root of your application to avoid position conflicts.
import React from 'react'
import NotificationsSystem, {atalhoTheme, useNotifications} from 'reapop'
const ATopLevelComponent = () => {
// 1. Retrieve the notifications to display, and the function used to dismiss a notification.
const {notifications, dismissNotification} = useNotifications()
return (
<div>
<NotificationsSystem
// 2. Pass the notifications you want Reapop to display.
notifications={notifications}
// 3. Pass the function used to dismiss a notification.
dismissNotification={(id) => dismissNotification(id)}
// 4. Pass a builtIn theme or a custom theme.
theme={atalhoTheme}
/>
</div>
)
}
3 - Set default notifications attributes
import {setUpNotifications} from 'reapop'
// run this function when your application starts before creating any notifications
setUpNotifications({
defaultProps: {
position: 'top-right',
dismissible: true
}
})
4 - Upsert or dismiss notification from any React components.
import React from 'react'
import {useNotifications} from 'reapop'
const AComponent = () => {
// 1. Retrieve the action to create/update a notification.
const {notify} = useNotifications()
useEffect(() => {
// 2. Create a notification.
notify('Welcome to the documentation', 'info')
}, [])
return (
...
)
}
Documentation
Read the documentation to learn more and see what you can with it.
License
Reapop is under MIT License
Top Related Projects
React notification made easy 🚀 !
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
🍞 A toast notification system for react
Smoking Hot React Notifications 🔥
Delightful and highly customisable React Component to notify your users
A beautiful replacement for JavaScript's "alert"
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot