score:2

Accepted answer

a few things are somehow confusing in your code:

after login:

    <button type="submit" onclick={logintodo}>
      signin
    </button>

function logintodo will be called:

    const logintodo = (a) => {
    a.preventdefault();
  };

the page won't refresh and that's it. you haven't defined anything to happen after that.

in signup

you call register function, inside, it dispatches this action:

 dispatch(
          logintodo({
            email: userauth.user.mail,
            uid: userauth.user.uid,
            displayname: name,
            photourl: profile,
          })

logintodo, as you defined just prevents page from refresh, it has nothing to do with your dispatch and actions. (also this is where the error comes from)

dispatch takes an object as argument, which usually has two properties: type and payload.

    const action={
                   type:"registeruser"  // the type depends on how you designed your reducer.
                   payload:userdata // email, name, ...
                 }
    dispatch(action)

sometimes people define actioncreators, that has the type itself, and only takes the payload:

const registeractioncreator=(payload)=>({type:"registeruser",payload:payload}) 

so alternatively you can use:

   dispatch(registeractioncreator(userdata))

Related Query

More Query from same tag