Adding authentication into our frontend
We incorporate our login functionality. We must start off by building the login form in the src/components/LoginForm.js
file. First, we import the following:
import React, {Component} from 'react'; import axios from 'axios'; import '../css/LoginForm.css';
The code for the imported CSS is provided in the Appendix of this chapter. We will not go through it here, as it is a lot of repetitive code. You can also download the CSS code from the GitHub repo. With these imports, we can build the framework for our login form with the following code:
class LoginForm extends Component { state = { username: "", password: "", } submitLogin = (e) => { . . . } ...