JakeSidSmith / react-fastclick

Fast Touch Events for React
https://www.npmjs.com/package/react-fastclick
MIT License
487 stars 41 forks source link

Allow conditional initilization #41

Closed dutzi closed 7 years ago

dutzi commented 7 years ago

Hi,

In our project we only need to use react-fastclick in some cases. Unfortunately, due to how it's initialized, this is is not possible.

When importing using import 'react-fastclick' the library gets initialized immediately, and since ES6 import statement cannot live inside an if clause we cannot use it conditionally.

What would be great is if we'd have a way to (1) import it; (2) initialize it.

I'll try making a PR for this.

JakeSidSmith commented 7 years ago

Fixed in #42