React component for canvas-confetti library
The react-canvas-confetti is a React component that allows users to integrate the canvas-confetti library into their React applications. This component provides an interface for creating and controlling confetti animations on a canvas element. Users can customize various parameters such as the number of confetti, angle, spread, start velocity, decay, gravity, drift, and origin. The react-canvas-confetti component offers two use cases: using callbacks to control the animation from the parent component or directly manipulating the component’s props to control the animation.
confetti prop to get the canvas-confetti instance into the parent component, allowing them to control the animation programmatically.fire prop to start the animation, the reset prop to reset all animations at once, and the onFire, onDecay, and onReset callbacks to trigger custom actions on animation events.width and height props, or they can use the className and style props for alternative ways to control canvas sizes.To install the react-canvas-confetti component, make sure you have React already installed as a peer dependency. Then, you can install the component via npm by running the following command:
npm install react-canvas-confetti
The react-canvas-confetti component provides a convenient way to integrate the canvas-confetti library into React applications. It offers various features such as animation control props, customization of confetti parameters, and callbacks for interacting with the animation from the parent component. With the react-canvas-confetti component, users can easily create and control confetti animations on a canvas element in their React applications.