Skip to content

Support for getInitalProps for nextjs #5

@g1aurav

Description

@g1aurav

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions