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. 如何修改win10管理员账户

    首先按下win+x组合键,如下图所示   在弹出菜单选择运行,如下图所示   在运行框中输入netplwiz后点击确定按钮   将下图中要使用本计算机必须输入用户名和密码前面的勾去掉,点击下方应用按钮 ...

  2. JSONP原理小记

    大家都知道JSONP(JSON with padding参数式JSON)是跨域传输数据的方法,jq等很多类库都封装了JSONP的方法,但是他的原理是怎样的呢?下面举个我认为最浅显的栗子,大家看过了都会 ...

  3. (转)cygwin个性化配置

    http://blog.cong.co/cygwin.html#%E5%AE%9A%E4%B9%89%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F配置 cygwin 中的服务 ...

  4. 多目录,多可执行文件的Makfile的编写

    1.前言 在目前的工作中,我遇到这样的一个工作情景,可以认为我要开发一个库,这个库的有多个模块,每个模块的.c放到src中,.h放到include中,这应该是个标准做法. drwxr-xr-x. ro ...

  5. C++嵌套类及对外围类成员变量的访问

    C++嵌套类及对外围类成员变量的访问 在一个类中定义的类称为嵌套类,定义嵌套类的类称为外围类. 定义嵌套类的目的在于隐藏类名,减少全局的标识符,从而限制用户能否使用该类建立对象.这样可以提高类的抽象能 ...

  6. Windows8 上用Ubuntu-Ubuntu启动SSH

    公司刚给配了一个电脑,华硕的超级本8个G的内存,很强大的了,但是系统是64位的windows 8,我用wubi.exe直接安装到系统上,但是开机启动的时候总是下面这个错误,去Ubuntu社区请教,结论 ...

  7. mysql高可用架构之-MHA学习

    此博文参考  博主:mysql高级DBA yayun  完成 简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司 ...

  8. cloudflare 301 重定向设置

    https://support.cloudflare.com/hc/en-us/articles/218411427#redirects 将 https://dfg.com/* 设置301重定向到 h ...

  9. C#发送POST,GET,DELETE请求API,并接受返回值

    发送POST请求 /// <summary> /// API发送POST请求 /// </summary> /// <param name="url" ...

  10. Python的程序结构[1] -> 方法/Method[2] -> 魔术方法 __init__ / __del__ / __new__

    魔术方法 / Magic Method 魔法方法就是可以给你的类增加魔力的特殊方法(实质应称为特殊方法,魔术方法在JavaScript中有所体现,对象具有不透明特性,而且无法在自定义对象中模拟这些行为 ...