Publish to my blog (weekly)
Hooks FAQ – React This is why usually you’ll want to declare functions needed by an effect inside of it. function doSomething ( ) { console . log ( someProp ) ; } productId productId That makes it easy to see which props or state your effect uses, and to ensure they’re all declared: The recommended fix is to move that function inside of your effect . productId productId ...