Skip to main content

useSignUpEmailPassword()

Overload 1 of 2

Email and Password Sign-Up

Parameters


options optional SignUpOptions


Examples

const {
signUpEmailPassword,
isLoading,
isSuccess,
needsEmailVerification,
isError,
error
} = useSignUpEmailPassword()
import { useState } from 'react'
import { useSignUpEmailPassword } from '@nhost/react'

const Component = () => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const {
signUpEmailPassword,
isLoading,
isSuccess,
needsEmailVerification,
isError,
error
} = useSignUpEmailPassword()

return (
<div>
<input
value={email}
onChange={(event) => setEmail(event.target.value)}
placeholder="Email"
/>
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
placeholder="Password"
/>
<button onClick={() => signUpEmailPassword(email, password)}>
Register
</button>
{isSuccess && (
<div>Your account have beed created! You are now authenticated</div>
)}
{needsEmailVerification && (
<div>
Please check your mailbox and follow the verification link to verify
your email
</div>
)}
</div>
)
}

Overload 2 of 2

Email and Password Sign-Up

Parameters


email optional string


password optional string


options optional SignUpOptions


Examples

const {
signUpEmailPassword,
isLoading,
isSuccess,
needsEmailVerification,
isError,
error
} = useSignUpEmailPassword()
import { useState } from 'react'
import { useSignUpEmailPassword } from '@nhost/react'

const Component = () => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const {
signUpEmailPassword,
isLoading,
isSuccess,
needsEmailVerification,
isError,
error
} = useSignUpEmailPassword()

return (
<div>
<input
value={email}
onChange={(event) => setEmail(event.target.value)}
placeholder="Email"
/>
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
placeholder="Password"
/>
<button onClick={() => signUpEmailPassword(email, password)}>
Register
</button>
{isSuccess && (
<div>Your account have beed created! You are now authenticated</div>
)}
{needsEmailVerification && (
<div>
Please check your mailbox and follow the verification link to verify
your email
</div>
)}
</div>
)
}