Created
February 17, 2018 22:05
-
-
Save flemdizzle/0bcbe8bf1570ae7e16f535a3f100b944 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| validationPlaceholder() { | |
| if (this.state.validation_error && this.state.validation_data.status === 'required') { | |
| return 'REQUIRED'; | |
| } | |
| }, | |
| toggleInput() { | |
| if (this.props.edit) { | |
| return ( | |
| <div> | |
| <PodInput | |
| placeholder={this.validationPlaceholder()} | |
| /> | |
| </div> | |
| ); | |
| } |
Oh woah, mapping those variables to this.state is pretty sweet. That's definitely not something I have seen before.
I suppose in this context, given the ternary statement, returning an empty string is a totally valid return.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would probably rewrite as: