Skip to content

Instantly share code, notes, and snippets.

@jeffhandley
Created December 7, 2017 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffhandley/76f74dee32fb7568108df533fd2c6e3e to your computer and use it in GitHub Desktop.
Save jeffhandley/76f74dee32fb7568108df533fd2c6e3e to your computer and use it in GitHub Desktop.
You don't need `do` to have if statements in functions
function View({ loading, error, ...otherProps }) {
if (loading) {
return (<Loading />);
}
if (error) {
return (<Error error={error} />);
}
return (<MyLoadedComponent {...otherProps} />);
}
@jeffhandley
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment