-
Notifications
You must be signed in to change notification settings - Fork 12
Accessing Current User Components
Tim Scott edited this page Aug 27, 2017
·
4 revisions
To access currentUser
in your components, just access it from the store as any other state.
import React from 'react';
import {connect} from 'react-redux';
const Home = ({currentUser}) => {
return (
<div>
<h1>Welcome {currentUser.email}</h1>
</div>
);
};
const mapStateToProps = state => {
return {
currentUser: state.currentUser
};
};
export default connect(mapStateToProps)(Home);