Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for getInitalProps for nextjs #5

Open
g1aurav opened this issue Feb 28, 2020 · 1 comment
Open

Support for getInitalProps for nextjs #5

g1aurav opened this issue Feb 28, 2020 · 1 comment

Comments

@g1aurav
Copy link

g1aurav commented Feb 28, 2020

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.

@faouzioudouh
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants