Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kayode-adechinan/f247ce2dbf5be21708491661ecbae63c to your computer and use it in GitHub Desktop.
Save kayode-adechinan/f247ce2dbf5be21708491661ecbae63c to your computer and use it in GitHub Desktop.
function UserGreeting(props) {
return <h1>Welcome back!</h1>;
}
function GuestGreeting(props) {
return <h1>Please sign up.</h1>;
}
function Greeting(props) {
const isLoggedIn = props.isLoggedIn;
if (isLoggedIn) {
return <UserGreeting />;
}
return <GuestGreeting />;
}
ReactDOM.render(
// Try changing to isLoggedIn={true}:
<Greeting isLoggedIn={false} />,
document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment