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

refactor: Use functional components instead of class components #39

Open
pahund opened this issue Mar 31, 2021 · 0 comments
Open

refactor: Use functional components instead of class components #39

pahund opened this issue Mar 31, 2021 · 0 comments
Labels
refactor Codebase is refactored

Comments

@pahund
Copy link

pahund commented Mar 31, 2021

The AdvertisingProvider is really messy, best would probably to rewrite it from scratch as functional component. This should also fix the warning message we currently have when running Jest tests:

 PASS  src/components/AdvertisingProvider.test.js (7.431 s)
  ● Console

    console.error
      Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
          at AdvertisingProvider (/Users/pahund/git/react-advertising/src/components/AdvertisingProvider.js:9:22)

      38 |       await this.advertising.setup();
      39 |       // eslint-disable-next-line react/no-did-update-set-state
    > 40 |       this.setState({
         |            ^
      41 |         activate: this.advertising.activate.bind(this.advertising),
      42 |         config: this.advertising.config,
      43 |       });
@pahund pahund added the refactor Codebase is refactored label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Codebase is refactored
Projects
None yet
Development

No branches or pull requests

1 participant