userHasAuthenticated is not a function

I’m loving this guide so far! I’ve come to the ‘Add the Session to the State’ section but after following all the steps, and after logging in, I’m getting an error that says “userHasAuthenticated is not a function”. I’m not sure what else to do. I tried looking at other forums that were dealing with the same issue but they forgot to add childProps to which I can’t find reference to in the guide so doesn’t really help me. Any help would be greatly appreciated!

If you are still having this issue can you post the code for the component that is generating the error?

The login component is generating the error. Not sure what I’m doing wrong.

export default function LoginComp(props) {    

    const [email, setEmail] = useState("");
    const [password, setPassword] = useState("");
    

    function validateForm() {
        return email.length > 0 && password.length > 0;
    }

    async function handleSubmit(event) {
        event.preventDefault();
      
        try {
          await Auth.signIn(email, password);
          props.userHasAuthenticated(true);
          props.history.push("/dashboard");
        } catch (e) {

            console.log("finished printing");
            alert(e.message);
        }
      }

Whats the error you are getting?

@easiruwa - Did you ever find a resolution to this? I am getting the same error. Similarly, in other topics I see reference to “childProps={childProps}”. I can only assume this is from an outdated version.

Similar to you, I get the error after I log in with correct credentials. The error is coming from the catch block in the HandleSubmit function:

} catch (e) {
alert(e.message);
}

localhost300 says:
userHasAuthenticated is not a function

There have been updates to that part of the guide. You can compare your setup to the one in the repo: