Skip to main content

useChangePassword()

Overload 1 of 2

Change password

Parameters


This overload doesn't accept any arguments.

Examples

const { changePassword, isLoading, isSuccess, isError, error } =
useChangePassword()
import { useState } from 'react'
import { useChangePassword } from '@nhost/react'

const Component = () => {
const [password, setPassword] = useState('')
const { changePassword, isLoading, isSuccess, isError, error } =
useChangePassword()

return (
<div>
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
/>
<button onClick={() => changePassword(password)}>Change password</button>
</div>
)
}

Overload 2 of 2

Change password

Parameters


email optional string


Examples

const { changePassword, isLoading, isSuccess, isError, error } =
useChangePassword()
import { useState } from 'react'
import { useChangePassword } from '@nhost/react'

const Component = () => {
const [password, setPassword] = useState('')
const { changePassword, isLoading, isSuccess, isError, error } =
useChangePassword()

return (
<div>
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
/>
<button onClick={() => changePassword(password)}>Change password</button>
</div>
)
}