File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
exercises/user_signup/solutions/codely_next-typescript-middle-out/src/components Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 1+ import React , { useState } from "react" ;
2+ import { Input } from "./Input" ;
3+
4+ type FormStatus = "success" | "error" | "initial"
5+
16export function SignUpForm ( ) {
2- return ( < > </ > )
7+ const [ formStatus , setFormStatus ] = useState < FormStatus > ( "initial" )
8+
9+ function handleSubmit ( ev : React . FormEvent ) {
10+ ev . preventDefault ( )
11+ setFormStatus ( "success" )
12+ }
13+
14+ if ( formStatus === "success" ) {
15+ return (
16+ < h1 > Thank you!</ h1 >
17+ )
18+ }
19+
20+ return ( < form onSubmit = { handleSubmit } >
21+ < Input label = "Name" id = "name" />
22+ < Input type = "email" label = "Email" id = "email" />
23+ < button type = "submit" > Submit</ button >
24+ </ form > )
325}
You can’t perform that action at this time.
0 commit comments