How handle server errors in React [closed]
Solution 1:
You can do a try catch , on the catch you use useState to set the value of the errors on a variable and show it on the html if the error is different to undefined
like this
try{ ... } catch {(error) => this.setState({err: error})}
{(this.state.err!== undefined) ? this.state.error ! ''}