Skip to content

Commit 9300ff8

Browse files
committed
remove usage of react state
1 parent 198cffa commit 9300ff8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/reference/hooks/use-waitlist.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ The following example demonstrates how to use the `useWaitlist()` hook to create
3737
'use client'
3838

3939
import { useWaitlist } from '@clerk/react'
40-
import { useState } from 'react'
4140

4241
export default function WaitlistPage() {
4342
const { waitlist, errors, fetchStatus } = useWaitlist()
44-
const [emailAddress, setEmailAddress] = useState('')
4543

46-
const handleSubmit = async (e: React.FormEvent) => {
44+
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
4745
e.preventDefault()
46+
const formData = new FormData(e.currentTarget)
47+
const emailAddress = formData.get('emailAddress') as string
48+
4849
await waitlist.join({ emailAddress })
4950
}
5051

@@ -64,9 +65,8 @@ export default function WaitlistPage() {
6465
<label htmlFor="email">Email address</label>
6566
<input
6667
id="email"
68+
name="emailAddress"
6769
type="email"
68-
value={emailAddress}
69-
onChange={(e) => setEmailAddress(e.target.value)}
7070
required
7171
/>
7272
{errors.fields.emailAddress && (

0 commit comments

Comments
 (0)