Created
December 21, 2018 12:04
-
-
Save jamesseanwright/52f6b62e03f1ccbdc561dfc6f51cedc6 to your computer and use it in GitHub Desktop.
React Props Example
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
const App: React.FC<AppProps> = ({ user }) => ( | |
<Header user={maybe(user)} /> | |
); | |
const Header: React.FC<UserProps> = ({ user }) => ( | |
<> | |
<Logo user={user} /> | |
<Account user={user} /> | |
</> | |
); | |
const Account: React.FC<UserProps> = ({ user }) => ( | |
user.isNothing() | |
? <SignInButton /> | |
: <p>Signed in as {user.value().name}</p> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment