Created
March 30, 2020 17:17
-
-
Save Porter97/e4269bc24cf3761bc114b0a7a8f800ff to your computer and use it in GitHub Desktop.
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
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