react-tracking icon indicating copy to clipboard operation
react-tracking copied to clipboard

Avoid referencing unbound methods Typescript error

Open piersolenski opened this issue 3 years ago • 1 comments

When using const { trackEvent } = useTracking();, Typescript throws the following error:

Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void or consider using an arrow function instead.

We're using the https://github.com/wesbos/eslint-config-wesbos config. It seems to happen when the function is already an arrow function. The use of other hooks in the same context do not throw this error.

piersolenski avatar Jul 18 '22 09:07 piersolenski

Not sure what this lint rule is meant to catch? What would the suggested fix be?

tizmagik avatar Sep 13 '22 20:09 tizmagik

Closing this as I'm not sure exactly what the issue or suggested fix is. Feel free to re-open with more context. Thanks!

tizmagik avatar Jun 02 '23 15:06 tizmagik