Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-fastclick with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. var reactFastclick = require("react-fastclick")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-fastclick v3.0.2

Fast Touch Events for React

React Fastclick CircleCI

Instantly make your desktop / hybrid apps more responsive on touch devices.

React Fastclick automatically adds fastclick touch events to elements with onClick attributes (and those that require special functionality, such as inputs) to prevent the delay that occurs on some touch devices.


Use npm to install react-fastclick

npm install react-fastclick


Initialize react-fastclick in your main javascript file before any of your components are created, and you're done.

Now any calls to onClick or elements with special functionality, such as inputs, will have fast touch events added automatically - no need to write any additional listeners.


import initReactFastclick from 'react-fastclick';


var initReactFastclick = require('react-fastclick');


  1. The event triggered on touch devices is a modified touchend event. This means that it may have some keys that are unusual for a click event.

In order to simulate a click as best as possible, this event is populated with the following keys / values. All positions are taken from the last know touch position.

  // Simulate left click
  button: 0,
  type: 'click',
  // Additional key to tell the difference between
  // a regular click and a flastclick
  fastclick: true,
  // From touch positions
  1. On some devices the elements flicker after being touched. This can be prevented by setting the css property -webkit-tap-highlight-color to transparent. Either target html, body (to prevent the flickering on all elements) or target the specific element you don't want to flicker e.g. button.

    html, body {
      -webkit-tap-highlight-color: transparent;


React Fastclick 3.x.x has been tested with React 15, but should support older versions also.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free