December 2018
Intermediate to advanced
642 pages
15h 5m
English
First, let's create a <Login> component that we'll call our RESTful server, passing a username and a password to it, and (if the values are right) getting back a JWT:
// Source file: src/routingApp/login.component.js/* @flow */import React from "react";import PropTypes from "prop-types";import { Redirect } from "react-router-dom";export class Login extends React.PureComponent<{ logging: boolean}> { static propTypes = { onLogin: PropTypes.func.isRequired, logging: PropTypes.bool.isRequired, token: PropTypes.string.isRequired, location: PropTypes.object }; state = { userName: "", password: "" }; onUserNameBlur = e => this.setState({ userName: e.target.value }); onPasswordBlur = e => this.setState({ password: e.target.value ...Read now
Unlock full access