Mixpanel provider for reactjs
Install the package
npm install --save mixpanel-provider-react
yarn add mixpanel-provider-react
Provider
import React from 'react';
import { MixpanelProvider } from 'mixpanel-provider-react';
const App = (props) => (
<MixpanelProvider apiKey={apiKey}>
...
</MixpanelProvider>
);
Send data with hook
import { useMixpanel } from 'mixpanel-provider-react';
const component = () => {
const mixpanel = useMixpanel('identity');
mixpanel.track('event', {
value
});
}
Run yarn test mixpanel-provider
to execute the unit tests via Jest.