React Moralis, signup hook

So I have a user registration form, where the user can sign up to the website.

Iā€™m using React Moralis.

This is the function called upon submit of the registration form.

When I comment out signup() it works fine

  const { signup } = useMoralis();
  const [email, setEmail] = useState("");
  const [userName, setUserName] = useState("");
  const [password, setPassword] = useState("");
  const [rePassword, setRePassword] = useState("");

  // Function called when the form is submitted.
  const handleSubmit = (event) => {
    //event.preventDefault() - for some reason this doesn't work either.

    if (password === rePassword) {
      signup(userName, password, email); // <-- The issue
    } else {
      console.log("Passwords do not match!");
    }
  };

The error I from signup() is

Ɨ
ā†ā†’1 of 2 errors on the page
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

I figured perhaps it is too many functions deep,

So I entered the signup directly into the form like so:

<form
    name="contactForm"
    id="contact_form"
    className="form-border"
    action=""
    onSubmit={() => signup(userName, password, email)}
>

The page will load, however, The information I enter is not entered in the database.

Hi @IntrepidShape

Please share the information bellow so we can help you:

  • Provide any screenshot about your error.
  • Provide your subdomain.

Also please share the request&response from the network devtools tab

can you add here a console log for those parameters before the signup?

I saw this kind of error in the past that was caused by using a variable name instead of a string in some other place in code.