Skip to content

Instantly share code, notes, and snippets.

@jamesseanwright
Created December 21, 2018 12:04
Show Gist options
  • Save jamesseanwright/52f6b62e03f1ccbdc561dfc6f51cedc6 to your computer and use it in GitHub Desktop.
Save jamesseanwright/52f6b62e03f1ccbdc561dfc6f51cedc6 to your computer and use it in GitHub Desktop.
React Props Example
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