Naming Prosecution Mitigator

    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    react-rewards logo

    npm version forthebadge

    Demo available here!


    This package was built using React-Pose, react-dom-confetti and Lottie-web.

    Why should I use that? Read my blog post and you will know –

    Install from npm by typing npm install react-rewards or yarn add react-rewards while in your package.json directory.

    This package lets you add microinteractions to your app, and rewards users with the rain of confettis, flying emoji or memphis design particles in seconds. In order to make it rain, you need to wrap your button of choice with the <Reward> component, fire the rewardMe() method from the refs and voilà. You can also "punish" the user by calling the punishMe() method and showing them that something went wrong.

    react-rewards demo

    import Reward from 'react-rewards';
    // in render
      ref={(ref) => { this.reward = ref }}
      <button onClick={this.fetchSomeData} />
    // in fetchSomeData:
    // to reward a user with confetti/emoji/memphis rain:
    // to "punish" user :

    Props & config

    Basic props:

    name type description required default
    ref func function that creates a ref of the reward component yes
    type string 'confetti', 'emoji' or 'memphis' no 'confetti'
    config object a configuration object described below no see below

    Config object:

    name type description default (confetti / emoji)
    lifetime number time of life of each particle in ms 200 / 200
    angle number initial direction of particles in degrees 90 / 90
    decay number how much the velocity decreases with each frame 0.91 / 0.91
    spread number spread of particles in degrees 45 / 100
    startVelocity number initial velocity of particles 35 / 20
    elementCount number particles quantity 40 / 15
    elementSize number particle size in px 8 / 20
    zIndex number z-index of particles 10 / 10
    springAnimation bool whether the button should be animated true
    colors array An array of colors used when generating confettis
    emoji array An array of emoji used when generating emoji particles


    npm i react-rewards

    DownloadsWeekly Downloads






    Unpacked Size

    5.04 MB

    Total Files


    Last publish


    • jakubszewczyk