I would like to integrate Mixpanel with React Native, I used this github source https://github.com/davodesign84/react-native-mixpanel
I tried all the same as described but I got this messages
Mixpanel.sharedInstanceWithToken is not a function
And 'Mixpanel.sharedInstanceWithToken' is undefined)
var Mixpanel = require('react-native-mixpanel');
componentDidMount() {
console.log('============>', Mixpanel) // it returns object
Mixpanel.sharedInstanceWithToken('xxx');
}

I tried many times with no success. App launches successfully but stops in the screen I used Mixpanel.sharedInstanceWithToken('xxx')
Thank you.
As @savelichalex mentioned in the comments using this will work:
const Mixpanel = require('react-native-mixpanel');
Mixpanel.default.sharedInstanceWithToken('MY_TOKEN');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With