import React, { Component } from 'react' import './App.css' class App extends Component { constructor () { super() this.state = { email: '', confirmEmail: '', userName: '', password: '', confirmPassword: '', agreeWithTerms: false, legitMail: false, legitName: true, legitPassword: true } this.submitReg = () => { let payload = this.state let data = new FormData() // data.append('json', JSON.stringify(payload)) console.log(payload) fetch('http://localhost:5000/auth/signup', { headers: { 'Content-Type': 'application/json' }, method: 'POST', body: JSON.stringify(payload) }) .then(r => { return r.json() }) .then(pr => { console.log(pr) }) } this.submiLog = () => {} this.promisfyState = newState => { return new Promise(res => { this.setState(newState, res) }) } } async componentDidUpdate () { if (this.state.email !== '') { if (this.state.email === this.state.confirmEmail) { await this.promisfyState({ legitMail: true }) } else { await this.promisfyState({ legitMail: false }) } } } shouldComponentUpdate (nextProps, nextState) { if (this.state.email === nextState.email) { return false } else { return true } } render () { return (