Created
August 29, 2018 08:35
-
-
Save gladchinda/ad1a4bc803ec1c2caa6c9fe38db1c6ca 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 from 'react'; | |
import { connect } from 'react-redux'; | |
import Profile from './components/Profile'; | |
function ProfileContainer(props) { | |
return ( | |
props.loggedIn | |
? <Profile profile={props.profile} /> | |
: <div>Please login to view profile.</div> | |
) | |
} | |
const mapStateToProps = function(state) { | |
return { | |
profile: state.user.profile, | |
loggedIn: state.auth.loggedIn | |
} | |
} | |
export default connect(mapStateToProps)(ProfileContainer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment