I am struggling with this bug. Here\'s my code:
It\'s long, so here\'s a short version: I have a form to create an event, I want handleSubmit() to handle error messages
So there are two problems with the code:
setState is async. It resolves after the function executes. Workaround: let error = false
at the beginning and then set error = true
together with setState call.
Empty objects are truthy. Thanks to error
variable, we can just change the condition to if(!error)
. Or do if(error) {return}
- this also works.
Oh, and the error message was from a chrome extension. Sucks that chrome doesn't tell you that an error message came from an extension - at least I don't think it does.
Best,