Skip to content

Instantly share code, notes, and snippets.

@sslotsky
Created May 22, 2018 23:43
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 sslotsky/eae524e8ab6e0fb044e5330212a874d6 to your computer and use it in GitHub Desktop.
Save sslotsky/eae524e8ab6e0fb044e5330212a874d6 to your computer and use it in GitHub Desktop.
import React from "react";
import { IdentityConsumer } from "./identity";
import Login from "./login";
export default function Home() {
return (
<IdentityConsumer>
{ctx => {
if (ctx.user) {
return <h1 data-cy="user">Hello {ctx.user.email}</h1>;
}
return !ctx.authenticated && <Login login={ctx.login} />;
}}
</IdentityConsumer>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment