# react-rewards

> This package lets you easily add micro-interactions to your app and reward users with the rain of confetti, emoji, balloons or fireworks, or a pop of stars.

Latest version **3.2.0** (published 2026-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-rewards
pnpm add react-rewards
yarn add react-rewards
bun add react-rewards
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2026-11-03 |
| First published | 2018-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 150.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1686 |
| Author | thedevelobear |
| Maintainers | jakubszewczyk |
| Keywords | react, react-rewards, confetti, emoji, balloons, fireworks, pop, cannon, microinteractions, micro-interactions, UI, UX |

## Links

- npm: https://www.npmjs.com/package/react-rewards
- Repository: https://github.com/thedevelobear/react-rewards
- Homepage: https://thedevelobear.github.io/react-rewards/
- Issues: https://github.com/thedevelobear/react-rewards/issues
- npm.io page: https://npm.io/package/react-rewards

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2026-11-03
- 3.1.0 — 2026-10-27
- 3.0.0 — 2026-10-24
- 2.1.0 — 2025-01-20
- 2.0.5 — 2025-01-20
- 2.0.4 — 2022-06-01
- 2.0.3 — 2022-03-28
- 2.0.2 — 2022-03-28
- 2.0.1 — 2022-03-28
- 2.0.0 — 2022-03-25
- 1.1.2 — 2020-10-16
- 1.1.1 — 2019-08-18
- 1.1.0 — 2019-08-16
- 1.0.7 — 2019-01-09
- 1.0.6 — 2018-12-26
- … 6 more at https://npm.io/package/react-rewards/versions

## README

![react-rewards logo](assets/react-rewards.png?raw=true "react-rewards")

[![npm version](https://badge.fury.io/js/react-rewards.svg)](https://badge.fury.io/js/react-rewards) [![forthebadge](https://forthebadge.com/images/badges/makes-people-smile.svg)](https://forthebadge.com)

❇️ **GPU-rendered**: WebGL2, with a Canvas 2D fallback

🌲 **Tree-shakeable**: about 7.5 kB gzipped for `useReward` and confetti

🕵️ **Built with TypeScript**

⏱️ **Frame-rate independent**, and quiet for people who prefer reduced motion

**React-rewards** lets you add micro-interactions to your app, and rewards users with the rain of confetti, emoji, balloons or fireworks, or a pop of stars, in seconds.
Firing confetti all over the page may seem like a questionable idea, but keep in mind that rewarding users for their actions is not.
If a huge cloud of smiling emoji doesn't fit your application well, try changing the physics config to make it more subtle.

You can read more on the subject of micro-interactions in my blog post - https://www.thedevelobear.com/post/microinteractions/

## Docs and demo

**[thedevelobear.github.io/react-rewards](https://thedevelobear.github.io/react-rewards/)** has every effect live, with its settings and the code for what you pick, and the docs:

- [Getting started](https://thedevelobear.github.io/react-rewards/#getting-started)
- [`useReward`](https://thedevelobear.github.io/react-rewards/#use-reward): its settings, burst options and return value
- [`fire`](https://thedevelobear.github.io/react-rewards/#fire): effects without React
- [Renderers](https://thedevelobear.github.io/react-rewards/#renderers): WebGL2, Canvas 2D and `setRenderer`
- [Custom effects](https://thedevelobear.github.io/react-rewards/#custom-effects) with `defineEffect`
- [Server rendering](https://thedevelobear.github.io/react-rewards/#server-rendering)
- [Upgrading from v2](https://thedevelobear.github.io/react-rewards/#upgrading-from-v2)

## Installation

```sh
pnpm add react-rewards
# or
npm install react-rewards
# or
yarn add react-rewards
```

React 18 or later. The package is ESM only.

## Usage

Give `useReward` a ref to the element a reward starts from, and an effect. Each call to `reward()` fires a burst from the centre of that element.

```tsx
import { useRef } from 'react';
import { confetti, useReward } from 'react-rewards';

export const RewardButton = () => {
  const ref = useRef<HTMLButtonElement>(null);
  const { reward, isAnimating } = useReward(ref, confetti);

  return (
    <button ref={ref} type="button" onClick={() => reward()}>
      {isAnimating ? 'Yay!' : 'Reward me'}
    </button>
  );
};
```

The effects are `confetti`, `emoji`, `balloon`, `firework` and `pop`, and each has its settings on [its page of the docs](https://thedevelobear.github.io/react-rewards/#confetti).

## Support

- React 18 or later.
- Chrome and Edge 87, Firefox 79, and Safari 14.1 (iOS 14.5), or later. Bursts draw with WebGL2 where it's available, and with Canvas 2D elsewhere.
- The package can be imported on the server: nothing touches `window` until a burst fires.
- Only the latest major version gets fixes.

Versions follow [semver](https://github.com/thedevelobear/react-rewards/blob/master/docs/decisions/0075-versioning-policy.md). A patch fixes something. A minor adds something, or changes how a built-in effect looks, and the changelog gives the old settings to keep the old look. A major can break your code, and whatever it removes is deprecated in a minor first.

## Contributing

The repo uses pnpm, and records its decisions in [`docs/`](docs/README.md). Start with [`AGENTS.md`](AGENTS.md) for the commands.

## License

MIT

---
_Source: https://npm.io/package/react-rewards · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
