Hacker News new | ask | show | jobs
by bbaumgar 2049 days ago
How can you apply this to debugging useEffect issues?
1 comments

You can set breakpoint inside useEffect and it will work as expected, you can use something like

if (somevar === 42) debugger;

and you'll see all of the internal call stack and all variables in scope. moreover you can use the console to evaluate your code. Worth mentioning 99% of strange issues in react (in my experience) are caused by mutation or not declaring all deps in hooks.