From 29d9f5ecad2261ed4e4f7712750cf2a126392d8e Mon Sep 17 00:00:00 2001 From: Renard Date: Mon, 16 Sep 2019 16:42:33 -0300 Subject: Fix: replyForm, setState es async! --- src/ReplyForm.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ReplyForm.js b/src/ReplyForm.js index 6695406..70e5d49 100644 --- a/src/ReplyForm.js +++ b/src/ReplyForm.js @@ -24,14 +24,7 @@ class ReplyForm extends Component { } handleSubmit() { - const { - submittedName, - submittedEmail, - submittedMessage, - name, - email, - message - } = this.state; + const { name, email, message } = this.state; this.setState( { submittedName: name, @@ -39,6 +32,7 @@ class ReplyForm extends Component { submittedMessage: message }, () => { + const { submittedName, submittedEmail, submittedMessage } = this.state; const data = { board: this.props.dir, parent: this.props.parent, @@ -65,7 +59,6 @@ class ReplyForm extends Component { return response.json(); }) .then(resource => { - console.log(resource); this.setState({ replyRes: resource }); }); } -- cgit v1.2.1-18-gbd029