react-tracker
react-tracker copied to clipboard
Support for getInitalProps for nextjs
I am using the project with a next.js setup. I was unable to use withTracking
HOC on page level components because react-tracker doesn't pass getIntialProps.
I was able to fix this locally by simply adding this to withTracking.js
file
if (Component.getInitialProps && typeof Component.getInitialProps === 'function') {
trackEventProvider.getInitialProps = Component.getInitialProps;
}
I can add a PR if other people also need this feature.
HI @g1aurav, Please feel free to create a PR :)