Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
react-toast
Advanced tools
Readme
yarn add react-toast
import { ToastContainer, toast } from 'react-toast'
const App = () => {
const wave = () => toast('Hi there 👋')
return (
<div>
<button onClick={wave}>Say hi!</button>
<ToastContainer />
</div>
)
}
Here's a little demo.
To use react-toast
, you need to put ToastContainer
in a top-level component in your application. e.g. App.js
It can take some props, here's a list of them:
Props | Type | Description | Default |
---|---|---|---|
position | top-left | top-center | top-right | bottom-left | bottom-center | bottom-right | position of toast | bottom-left |
deplay (ms) | number | delay for toast | 6000 |
There are 4 base toast type available, success
, error
, info
and warn
. For instance:
const success = () => toast.success('Message sent successfully!')
or
fetch('someRandomUrl')
.then(res => res.json())
.then(res => console.log(res))
.catch(err => toast.error(err.message))
Custom toast
Of course you can display custom toasts 😅, here's a gist and a list of options that are available for customization:
const customToast = () =>
toast('Morning! Have a good day.', {
backgroundColor: '#8329C5',
color: '#ffffff',
})
Property | Type | Description | Default |
---|---|---|---|
backgroundColor | string | background color of toast | based on toast type, e.g. success will be green |
color | string | color of text in toast | #ffffff |
FAQs
Minimal toast notifications for React.
We found that react-toast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).