From 3f8ba5655b1d2f6d23f75f702d944d0c03bbac71 Mon Sep 17 00:00:00 2001 From: Tyler Collier <31582611+tylercollier-devmtn@users.noreply.github.com> Date: Thu, 30 Nov 2017 16:19:55 -0700 Subject: [PATCH] Clarify Step 6 I found the instructions for Step 6 confusing. The solution calls setState even when it's not really updating. Hopefully this is clearer for intent and solution is more straightforward. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 091cca5..20ddd95 100644 --- a/README.md +++ b/README.md @@ -567,9 +567,7 @@ In this step we will be tweaking our calculator to handle certain scenarios. If * Assign the new variable `display` a value: * If `this.state.display` is `"0"` then `display` should equal `num` * Otherwise `display` should equal `this.state.display` + `num` -* Modify `this.setState` to update display: - * If `this.state.display` is less than 13 characters then update with the new `display` variable. - * Otherwise update with the current value of `this.state.display`. +* If `this.state.display` is less than 13 characters, update the state's display value to `display`. Otherwise, don't update it. ### Solution @@ -579,8 +577,10 @@ In this step we will be tweaking our calculator to handle certain scenarios. If ```jsx setDisplay(num) { - var display = ( this.state.display === '0' ) ? num : this.state.display + num; - this.setState({ display: (this.state.display.length < 13) ? display : this.state.display }) + if (this.state.display.length < 13) { + const display = this.state.display === '0' ? num : this.state.display + num + this.setState({ display: display }) + } } ```