Created
July 18, 2022 23:16
-
-
Save rayrayzayzay/295b52fa4153b1115f70c8c45de1b167 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
✅ A simpler component | |
function UserProfile({ request }: | |
{ request: UserProfileRequest }) { | |
switch (request.status) { | |
case "fetching": | |
return <Spinner /> | |
case "success": | |
return <UserProfileCard user={request.data} /> | |
case "error": | |
return ( | |
<ErrorMessage | |
code={request.statusCode} | |
message={request.errorMessage} | |
/> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment