Adding States to Form Groups.

This commit is contained in:
Ray 2023-09-12 10:40:54 +00:00 committed by GitHub
parent 9781154b53
commit 0861cc7455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 5 deletions

View File

@ -16,8 +16,11 @@ export function Signup ( props ) {
}
useEffect( () => {
if(username.length > 4) {
console.log("longer than 4 characters")
if(username.length >= 4) {
setValidusername(true)
}
else {
setValidusername(false)
}
}, [username] )
@ -38,11 +41,21 @@ export function Signup ( props ) {
</Form.Group>
<Form.Group>
<Form.Label>Email</Form.Label>
<Form.Control type="email" name="email" placeholder='you@example.com'/>
<Form.Control
type="email"
name="email"
placeholder="you@example.com"
onChange={ (evt) => setUseremail(evt.target.value) }
/>
</Form.Group>
<Form.Group>
<Form.Label>Password</Form.Label>
<Form.Control type="password" name="password" placeholder='password'/>
<Form.Control
type="password"
name="password"
placeholder='password'
onChange={ (evt) => setUserpassword(evt.target.value) }
/>
</Form.Group>
<Button variant="primary" className="mt-3 w-100" type="submit">Sign up</Button>
</Form>