Created
July 17, 2019 16:21
-
-
Save jamesseanwright/36a9c2cdfd4c6316eb3f34ae6986180f to your computer and use it in GitHub Desktop.
React lazy resolution state tracking
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
| switch (status) { | |
| case Resolved: { | |
| const Component: T = result; | |
| return Component; | |
| } | |
| case Rejected: { | |
| const error: mixed = result; | |
| throw error; | |
| } | |
| case Pending: { | |
| const thenable: Thenable<T, mixed> = result; | |
| throw thenable; | |
| } | |
| default: { | |
| // ... | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment