nhagen / react-intercom

A component to configure and enable Intercom in your react application
MIT License
237 stars 72 forks source link

will using this lib solve my issue of window.Intercom is not a function error #22

Closed jasan-s closed 7 years ago

jasan-s commented 7 years ago

the problem I'm running into when using intercom directly is that I keep getting the error that window.Intercom is not a function because I am async loading the SDK when the main component mounts. Thus its not available in other components at the time of their lifecycle event(component did mount).

nhagen commented 7 years ago

You'll get a log message saying Intercom has not initialized yet rather than a type error. This component loads the Intercom code asynchronously still, so if you're trying to use features before the script has loaded, it likely wont work as expected. Its probably possible to add a queue for events that should be fired once its finished loading, however.