Skip to content

Getting warning "Support for defaultProps will be removed from function components in a future major release." #230

Description

@SharathSreekumar

Issue

Getting a warning on the browser console "Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.".
This happened post upgrade to the following:

  • React: 18.2.0
  • react-tracking: 9.3.2 (tried downgrading till 9.2.1, below versions require 16.8.0 or 17.x)
  • @types/react-tracking: 8.0.0
    Screenshot from 2024-10-01 14-48-48

Details

The warning is shown on components that either has class component (hence using the decorator @track({<DETAILS>})) and in functional components (using the export default track({<DETAILS>})(Componentx))

On trying with the packages hook, the warning is not shown.
const { Track, trackEvent } = useTracking({<DETAILS>});

NOTE: React project is written in Typescript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions