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 | });
The
AdvertisingProvideris 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: