Created
November 18, 2018 20:14
-
-
Save e-l-i-s-e/b7f9522d799e6f6c6cf08e3c81ddb10d to your computer and use it in GitHub Desktop.
Medium article example
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
| if (action instanceof Promise) { | |
| this.setState({ | |
| [`${name}Status`]: { | |
| isLoading: true | |
| } | |
| }); | |
| return action | |
| .then(() => { | |
| this.setState({ | |
| [`${name}Status`]: { | |
| isLoading: false | |
| }, | |
| }); | |
| }) | |
| .catch(error => { | |
| this.setState({ | |
| [`${name}Status`]: { | |
| isLoading: false, | |
| error | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment