Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-toast
Advanced tools
Readme
Install with yarn
yarn add react-toast
Install with NPM
npm install 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>
)
}
Demo on CodeSandbox.
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
You can display custom styled toasts, here's an example 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.
The npm package react-toast receives a total of 1,545 weekly downloads. As such, react-toast popularity was classified as popular.
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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.