use-http icon indicating copy to clipboard operation
use-http copied to clipboard

Access error value but it's undefined

Open guilhermebayerzup opened this issue 5 years ago • 0 comments

Describe the bug I'm normalizing the error code from the response with a message and I need to access this error inside the promise then, to do some more things, more in some cases the error from useFetch destructuring was undefined. I think its more a question than a bug maybe.

⚠️ Make a Codesandbox ⚠️ https://codesandbox.io/s/silly-napier-wxs53?file=/src/App.js

To Reproduce Steps to reproduce the behavior: 2. Click on submit button 3. See console.log from error variable on line 37, some cases it's undefined, the one on line 41 always comes with the error value

guilhermebayerzup avatar Jul 28 '20 02:07 guilhermebayerzup