I’m trying to use useEffect function like that: But when I try to use data variable it sometimes throws this error: I don’t know, where do I miss. Answer You can only pass a normal function as argument to useEffect, and not an async function. In order to use async await in useEffect, you can write your function as an
Tag: use-effect
Behaviour of a function in useEffect when different browser tab is active
I have a weird issue. I’ve created a function that aims to reset the Linearprogress element after 60 seconds. Then, I have a render of linear progress element like this : Now the weird part : when Im looking at my app all looks normal, after 60 seconds the bar resets to start and that repeats on. However, when I
What’s the best way to avoid react-hooks/exhaustive-deps?
I currently use the useEffect hook to run some function or update a variable as an effect of another value/variable being changed example: I am using the above code to update a variable after another variable has changed, however i keep getting the warning that React Hook useEffect has a missing dependency ‘types and obviosuly when i include ‘types’ as