Signin component

The Signin component in client/auth/Signin.js is also a form with only email and password fields for signing in. This component is quite similar to the Signup component and will render at the '/signin' path. The key difference is in the implementation of redirection after successful sign-in and storing of the received JWT:

For redirection, we will use the Redirect component from React Router. First, initialize a redirectToReferrer value to false in the state with the other fields:

mern-skeleton/client/auth/Signin.js:

class Signin extends Component { state = { email: '', password: '', error: '', redirectToReferrer: false } ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.