Skip to content

Tag: hook

Property does not exist on type void

I am writing a hook to make a post request that returns two properties, sessionId and sessionData. I am using this hook in a component. My hook looks like this. And my component look like this When I try to access data.sessionData on the component I get the error that sessionDta does not exist on type void. B…

Hooking Function Constructor (JavaScript)

Does anyone know of a way to detect when a new function is created? I know you can hook the function class constructor but that will only detect new Function() calls, not function func(){} declarations. I assume the JS engine just creates a default function class when it sees a function declaration instead of…

How to run useQuery inside forEach?

I have loop – forEach – which find productId for every element of array. I want to fetch my database by productId using apollo query. How to do it? Answer From the rules of hooks: Don’t call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the top level of your Rea…