Checking if a state object is empty

Actually, You need to first check this.state.errors is exist or not and then for object is null or not

if (this.state.errors && !Object.keys(this.state.errors)) {
    this.props.updateUser(user);
    this.props.navigation.goBack();
}

Try checking the state instead of the errors collection:

if (this.state) {
    this.props.updateUser(user);
    this.props.navigation.goBack();
}

cheers


Given that this.state.errors is an object you can do this,

//when this.state.errors object is empty 
if (Object.keys(this.state.errors).length == 0) {
  this.props.updateUser(user);
  this.props.navigation.goBack();
}

Object.keys will return an array or all the keys from the object this.state.errors. Then you can check the length of that array to determine if it is an empty object or not.