It's important that our users enjoy using our application or website. One way we can make it happen is by adding microinteractions to subtly reward our users for performing certain actions.

In this quick lesson we are going to learn how to use react-rewards to add microinteractions (such as rain of confetti or emojis) to a simple React application.

Install:

npm i --save react-rewards

Wrap a button into Reware component:

        <Reward
ref={ref => {
this.reward = ref;
}}
type="emoji"
config={{
springAnimation: false,
elementCount: 8
}}
>
<button onClick={this.processLike}>
{!this.state.isLiked ? "Like this tweet ✅" : "Post liked, yay!

[React] Use react-rewards to add microinteractions to React app to reward users for some actions的更多相关文章

  1. 【React自制全家桶】一、Webstrom+React+Ant Design+echarts搭建react项目

    前言 一.React是Facebook推出的一个前端框架,之前被用于著名的社交媒体Instagram中,后来由于取得了不错的反响,于是Facebook决定将其开源.出身名门的React也不负众望,成功 ...

  2. React与ES6(四)ES6如何处理React mixins

    React与ES6系列: React与ES6(一)开篇介绍 React和ES6(二)ES6的类和ES7的property initializer React与ES6(三)ES6类和方法绑定 React ...

  3. react看这篇就够了(react+webpack+redux+reactRouter+sass)

    本帖将对一下内容进行分享: 1.webpack环境搭建: 2.如何使用react-router: 3.引入sass预编译: 4.react 性能优化方案: 5.redux结合react使用: 6.fe ...

  4. 玩转 React 【第03期】:邂逅 React 组件

    上期回顾 前文我们讲解了 React 模板 JSX,接着我们继续来看看 React 组件又是如何工作的呢? 组件化开发到了今天已经是大家的共识,在 React 中,组件同样也是组成我们整个项目的基本单 ...

  5. [React] Use the Fragment Short Syntax in Create React App 2.0

    create-react-app version 2.0 added a lot of new features. One of the new features is upgrading to Ba ...

  6. Wait… What Happens When my React Native Application Starts? — An In-depth Look Inside React Native

    Discover how React Native functions internally, and what it does for you without you knowing it. Dis ...

  7. react 16.8版本新特性以及对react开发的影响

    Facebook团队对社区上的MVC框架都不太满意的情况下,开发了一套开源的前端框架react,于2013年发布第一个版本. react最开始倡导函数式编程,使用function以及内部方法React ...

  8. [React] Use React.cloneElement to Modify and Add Additional Properties to React Children

    In this lesson we'll show how to use React.cloneElement to add additional properties to the children ...

  9. [转] React Native Navigator — Navigating Like A Pro in React Native

    There is a lot you can do with the React Native Navigator. Here, I will try to go over a few example ...

随机推荐

  1. Windows Server 创建环回网卡

    1.以管理员身份运行cmd后,在cmd命令窗口中执行:hdwwiz 启动硬件添加向导. 2.在添加硬件向导中选择手动安装或自动搜索都可以.然后选择网络适配器. 3.选择网络适配器:厂商选择Micros ...

  2. Linux临时增加swap空间

    linux临时增加swap空间:step 1: #dd if=/dev/zero of=/home/swap bs=1024 count=500000 注释:of=/home/swap,放置swap的 ...

  3. 手动删除Win7系统服务列表中残留服务的操作步骤

    卸载tomcat的时候服务用cmd运行不能删除 需要用管理员才能删除 手动删除Win7系统服务列表中残留服务的操作步骤分享给大家,在使用深度Win7系统过程中,将一些程序删除后,有些在服务列表中还会残 ...

  4. MATLAB7 + sqlitejdbc-v056.jar 访问数据库

    以下代码出错: conn=database('data.db','','','org.sqlite.JDBC','jdbc:sqlite:C:/MATLAB7/work/del_man_voice_f ...

  5. eclipse非主窗口的停靠(正常), 恢复, 最小化, 最大化的切换

    1. pydev package Explorer的停靠与内嵌等 正常的情况

  6. Linux下USB驱动框架分析【转】

    转自:http://blog.csdn.net/brucexu1978/article/details/17583407 版权声明:本文为博主原创文章,未经博主允许不得转载. http://www.c ...

  7. UVALive 3507:Keep the Customer Satisfied(贪心 Grade C)

    VJ题目链接 题意: 知道n(n <= 8e6)个工作的完成所需时间q和截止时间d,你一次只能做一个工作.问最多能做多少工作? 思路: 首先很像贪心.观察发现如下两个贪心性质: 1)一定存在一个 ...

  8. python 实现经典算法

    import time start_time = time.clock() list_ = [9, 2, 7, 4, 5, 6, 3, 8, 1] """ # 堆排序(通 ...

  9. JAVA向EXE文件尾追加配置信息,用于解决局版客户端的程序IP配置问题

    package com.demo.blog; import java.io.DataOutputStream;import java.io.File;import java.io.FileOutput ...

  10. [BZOJ1455]罗马游戏 左偏树+并查集

    1455: 罗马游戏 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 2285  Solved: 994[Submit][Status][Discuss] ...