How to Make Confetti with React

React Confetti is an open source React component that lets you randomly add particle animations to your project.

 

react-confetti


Questions About react-confetti

How to Create a Simple yet Breathtaking Gradient with React-Confetti Component: Learn how to create gradients in React.

A cool react component that adds an animated confetti effect to any element.

Blow Their Minds With This Interactive Confetti Installation

Looking for a simple, lightweight, customizable confetti popper? 

The Easiest Way to Add Animated Confetti to Your React App

An easy and fun way to add confetti and effects to any ReactJS application

react-confetti is for anyone who uses React and wants to save time by not having to think about styling.

React can style components with CSS, but sometimes you might want to throw in a bit of JavaScript. Or throw in a bit more JavaScript. react-confetti is designed to make throwing in JavaScript easier, more flexible, and debuggable.

react-confetti is the most advanced, easy-to-use party streamer in the world, and it's fully customizable! You can change the colors of any or all of the streamers by dragging color swatches around. The GIF confetti will replace the default images when you're done adjusting them. The default confetti show will last for 25 seconds - any number of items may be shown during that time (including none).

react-confetti is a simple jQuery plugin that will allow you to easily apply confetti to your React project. It's lightweight, easy to use, and comes with various ways of applying confetti to your application. The plugin works on both the server and the client-side.

Create a confetti explosion and blow your audience away with react-confetti. This react component wraps the API provided by MDG and gives you an API that is simple and easy to use. It's very straightforward. A functional and fun sprinkle react component.

Add a little something extra to your React app by displaying a personalized welcome greeting, along with the time and recent messages. The Confetti component makes it easy to display messages and welcome messages inside your app! Use it as an Alert, as a welcome screen component, like a tip jar for donations, like a progress bar, as an intro screen..... the possibilities are endless!.

Picture your celebration: a confetti of iconic shapes and sizes, sparks and pops of color, and even party animals of every kind. This little box lets you bring the fun.  Our mix includes classic confetti in surprising shapes, with a bit of orange peel and shaving from a fresh barber, cut mixed in for that extra party zing.

Install react-confetti package


npm i react-confetti
# or yarn add react-confetti

Code



import Head from "next/head";
import styles from "../styles/Home.module.css";
import Confetti from 'react-confetti'
import { useEffect , useRef , useState} from "react";

export default function Home() {
  const [ height , setHeight] = useState(null)
  const [ width , setWidth] = useState(null)
  const [show , setShow] = useState(false)
  const ConRef = useRef()
  const onClickhandler =()=>{
    setShow(true)
  }

  useEffect(() => {
    setHeight(ConRef.current.clientHeight)
    setWidth(ConRef.current.clientWidth)
    
  }, [])
  return (
    <div ref="{ConRef}">
      <body>
      <button onclick="{onClickhandler}">Click Me  </button>
      <confetti height="{height}" numberofpieces="{1000}" run="{show}" width="{width}">
      </confetti></body>
    </div>
  );
}

thanks for reading

react-confetti codepen
react-confetti-canvas
react-confetti examples
react-confetti duration
react-confetti explosion
react confetti cannon
react confetti timeout
react native confetti
react-confetti npm
react confetti animation
react native confetti animation
react confetti button
react-native-confetti-cannon
react confetti on click
react-native-confetti-cannon example
react-dom-confetti
react-dom-confetti example
npm install react-dom-confetti
react confetti effect
confetti for react
confetti in react
import react confetti
install react confetti
confetti react js
react-native-confetti view