You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me a moment to realize that I was destructuring a class method, hence why the this context of the class was undefined, causing the error to be thrown.
So obviously rewriting the call as hooks.useInfiniteQuery() works as expected.
I think there are a couple of ways that the code could be modified to ensure that the context exists when used in this manner.
Bind the this context to the method in the constructor:
I ran into a somewhat unexpected issue -- when destructuring
useInfiniteQuery
from hooks a type error is thrown:Minimal example:
Repro: https://codesandbox.io/s/zodios-infinite-query-issue-lo5nlb?file=/src/Data.tsx
It took me a moment to realize that I was destructuring a class method, hence why the
this
context of the class was undefined, causing the error to be thrown.So obviously rewriting the call as
hooks.useInfiniteQuery()
works as expected.I think there are a couple of ways that the code could be modified to ensure that the context exists when used in this manner.
this
context to the method in the constructor:The text was updated successfully, but these errors were encountered: