From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Hook up sign-in form

Hook up sign-in form

All right, guys, so now we're going to hook the sign up form or sign in form, sorry. We're going to hook that up to the action, the sign in with credentials action. And we're going to be using some new React hooks called use action state and use form status. So the three pages that I have open are the three files. I have the actions file open. We're not going to edit this or anything. We're not doing anything to it. But I just want to show you the action state that I'm talking about is an object with success and message. Whether it's successful and we get success true with this message, or it's not, success falls with this message. That's the action state. Now, in the Credentials sign-in form, I also have the page open, the sign-in page, because we're going to do some stuff there as well. But let's go into the Credentials sign-in form. And this is where we want to submit to that action. So we're going to bring that in. So let's say import sign-in with credentials. That's going to come…

Contents