zilverline / react-tap-event-plugin

Instant TapEvents for React
http://facebook.github.io/react/
MIT License
1.07k stars 110 forks source link

How to use when there are multiple components? #76

Open audetpascale opened 8 years ago

audetpascale commented 8 years ago

Hi,

Context: we are using React and Kendo (do not blame me lol). Currently, we have the main application, everything is fine with the plugin. However, when I render a new component in the Kendo stuff, well, the plugin is "unavailable" (or seems to).

In other words, I can have two and more ReactDOM.render(...) in a page, the main app and the one created inside Kendo lib. Is it my issue? If yes, do you have suggestion?

Thanks for your response and plugin! Pascale Audet

alexiusp commented 7 years ago

Yes, I have this issue too. I'm trying to do like this in every component:

try {
  // wrapping it in try-catch to prevent errors on duplicate injection
  injectTapEventPlugin();  
} catch (error) {  
}

But I'm not sure if it works correctly - I have just started. I would also recommend to replace an error throw on calling the injectTapEventPlugin() with a warning.