Giter VIP home page Giter VIP logo

Comments (3)

jonkoops avatar jonkoops commented on July 26, 2024

Hi @JLyons1985, according to the React documentation it is not possible to use hooks in class components:

You can’t use Hooks inside a class component, but you can definitely mix classes and function components with Hooks in a single tree. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. In the longer term, we expect Hooks to be the primary way people write React components.

Since the React team has expressed that Hooks will be the primary way of writing React components going forwards we have chosen not to support class style components.

We do however have a package called matomo-tracker-js that is not tied to React that you can use directly. This package is used by matomo-tracker-react internally so it should be able to do everything you need.

from matomo-tracker.

exinferis avatar exinferis commented on July 26, 2024

Since both class based components and function components are equally supported by react and larger projects tend to strongly favour class based components this should be considered to be reopened.

from matomo-tracker.

jonkoops avatar jonkoops commented on July 26, 2024

Since both class based components and function components are equally supported by react and larger projects tend to strongly favour class based components this should be considered to be reopened.

We recommend you use a functional container component and pass in the methods you need to accomplish this.

from matomo-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.