Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created August 29, 2018 08:35
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 gladchinda/ad1a4bc803ec1c2caa6c9fe38db1c6ca to your computer and use it in GitHub Desktop.
Save gladchinda/ad1a4bc803ec1c2caa6c9fe38db1c6ca to your computer and use it in GitHub Desktop.
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