@guanghechen/react-confetti
TypeScript icon, indicating that this package has built-in type declarations

2.3.14 • Public • Published

@guanghechen/react-confetti


Simple confetti particle in React.

Install

  • npm

    npm install --save @guanghechen/react-confetti
  • yarn

    yarn add @guanghechen/react-confetti

Usage

import { useThrowRandomConfetti } from '@guanghechen/react-confetti'
import React from 'react'

const App: React.FC = () => {
  const throwConfetti = useThrowRandomConfetti()
  const [tick, setTick] = React.useState<number>(0)

  React.useEffect(() => {
    if (tick > 0) void throwConfetti()
  }, [tick])

  return <button onClick={() => setTick(c => c + 1)}>throw confetti</button>
}

Related

Package Sidebar

Install

npm i @guanghechen/react-confetti

Weekly Downloads

11

Version

2.3.14

License

MIT

Unpacked Size

17.6 kB

Total Files

8

Last publish

Collaborators

  • lemonclown