score:0

you are passing the errors state instead of any actual props value. from what i can tell, it seems you should pass the ui prop to your componentwillreceiveprops utility.

const signin = ({ classes, ui }) => {
  // const { email, password, errors, handlesubmit, handlechange } = usersignin();

  ...
  const [errors, seterrors] = usestate({});

  useeffect(() => {
    componentwillreceiveprops(ui);
  }, [ui]);

  ...

  const componentwillreceiveprops = (uiprop) => {
    if (uiprop?.errors) {
      seterrors({ errors: uiprop.errors });
    }
  };

  return (
    ...
  )
};

signin.proptypes = {
  classes: proptypes.object.isrequired,
  signinuseraction: proptypes.func.isrequired,
  user: proptypes.func.isrequired,
  ui: proptypes.func.isrequired,
};

const mapstatetoprops = (state) => ({
  user: state.user,
  ui: state.ui,
});

const mapactionstoprops = { signinuseraction };

export default connect(
  mapstatetoprops,
  mapactionstoprops
)(withstyles(theme.styles)(signin));

Related Query

More Query from same tag