#Login with Next-auth and FormData

1 messages · Page 1 of 1 (latest)

river finchBOT
#

Hi @ripe wagon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, here's an example of how you can get FormData in HTML <form></form> tags using 'use client' in Next.js:

'use client'
 
import { useState } from 'react'
import { handleSubmit } from './actions.js'
 
export default function ExampleClientComponent({ myAction }) {
 const [input, setInput] = useState()
 
 return (
 <form action={handleSubmit} onChange={(e) => setInput(e.target.value)}>
 {/* ... */}
 </form>
 )
}

In this example, the useState hook is used to manage the form data. The onChange event handler updates the state with the form data every time the form input changes. The handleSubmit function, which is imported from './actions.js', is used as the form's action. This function would handle the form submission.

However, the extracts do not provide information on how to log in with Next-Auth. For that, you may want to refer to the Next-Auth documentation (https://next-auth.js.org/getting-started/introduction) or other relevant resources.

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: