Skip to content

Instantly share code, notes, and snippets.

@Porter97
Created March 30, 2020 17:17
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 Porter97/e4269bc24cf3761bc114b0a7a8f800ff to your computer and use it in GitHub Desktop.
Save Porter97/e4269bc24cf3761bc114b0a7a8f800ff to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
const LoggedOutView = props => {
if (!props.currentUser) {
return (
<h4>Welcome to Offbrand!</h4>
)
}
return null;
};
const LoggedInView = props => {
if (props.currentUser) {
return (
<h4>Welcome back, {props.currentUser.name ? props.currentUser.name : props.currentUser.username}</h4>
)
}
return null;
};
class Home extends Component {
render() {
return (
<div className="container page">
<LoggedOutView currentUser={this.props.currentUser} />
<LoggedInView currentUser={this.props.currentUser} />
</div>
)
}
}
export default Home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment