A React Hook for debugging state changes.
npm i use-debuggable-state
Set the flag in the root file of your project.
window.reactDebugMode = true;
Replace your usages of useState
with useDebuggableState
In the browser dev console, dump out the stacktrace
console.log(window.reactDebug.stack)