Im new to react JS. when user clicks the button, needs to catch and display the error from back-end to user without using Hooks.
class createform extends React.component{
constructor(props){
super(props);
this.handlecreateform = this.handlecreateform.bind(this);
}
async handlecreateform(){
try{
// some logic happens;
}
catch(err){
this.setstate({error});
}
I don't know how to display this error in render and return to user. Any help is greatly appreciated!