react-tracker icon indicating copy to clipboard operation
react-tracker copied to clipboard

Support for getInitalProps for nextjs

Open g1aurav opened this issue 4 years ago • 1 comments

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.

g1aurav avatar Feb 28 '20 13:02 g1aurav

HI @g1aurav, Please feel free to create a PR :)

faouzioudouh avatar Mar 19 '20 12:03 faouzioudouh