#React component | onSubmit not working

23 messages ยท Page 1 of 1 (latest)

proven aurora
#

Hi! Why is my handleSubmit function not trigggered?
There is no error.

proven aurora
#

anyone a idea?

drifting cairn
#

Hey, are you using a client directive in your component?

drifting cairn
#

Oh I mean in the Astro component you're using this component in

proven aurora
#

No

---
/* Import components */
import RegisterForm from "../../components/auth/RegisterComponent.jsx";

/* Import api classes */
import Auth from "../../api/Auth.js";
---

<!DOCTYPE html>
<html lang="de">
    <head>
        <!-- Meta tags -->
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Website title -->
        <title>YourDevelopers - Auth</title>
        <link rel="icon" type="image/svg+xml" href="/img/logo-icon.svg" />

        <!-- Public css files -->
        <link rel="stylesheet" href="/css/root.css">
    </head>
    
    <body>
        <RegisterForm/>
    </body>
</html>
drifting cairn
#

Ah you should use one then ๐Ÿ˜„
Otherwise no javascript is sent to the browser, only the html of your form

proven aurora
drifting cairn
#

Yeah any would be a good choice

drifting cairn
proven aurora
proven aurora
drifting cairn
#

What do you want executed on the clientside and what on the server exactly?

proven aurora
drifting cairn
#

Ah I see, you could use an api route to handle that, and make a fetch call to it on the client

proven aurora
drifting cairn
#

No problem!

#

Do let me how it goes ๐Ÿ™‚

proven aurora
#

Thanks