Created
December 7, 2017 15:39
-
-
Save jeffhandley/76f74dee32fb7568108df533fd2c6e3e to your computer and use it in GitHub Desktop.
You don't need `do` to have if statements in functions
This file contains 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
function View({ loading, error, ...otherProps }) { | |
if (loading) { | |
return (<Loading />); | |
} | |
if (error) { | |
return (<Error error={error} />); | |
} | |
return (<MyLoadedComponent {...otherProps} />); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://twitter.com/JeffHandley/status/938794811850612738