Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import Header from './Header';
  4. import UserAvatar from './UserAvatar';
  5. import EventsSection from './UserEvents';
  6. import { addUser } from '../actions/userActions';
  7.  
  8. class EventDashboardPage extends Component {
  9. componentDidMount = () => {
  10. this.props.dispatch(addUser());
  11. // this.setState({ imageSrc: res.url });
  12. }
  13.  
  14. render() {
  15. console.log(this.props, 'thisprops in render');
  16. return (
  17. <React.Fragment>
  18. <Header/>
  19. <main className='main'>
  20. <div className='row'>
  21. <div className='container'>
  22. <UserAvatar userData={this.props.userData} />
  23. <EventsSection />
  24. </div>
  25. </div>
  26. </main>
  27. </React.Fragment>
  28. );
  29. }
  30. }
  31.  
  32. const mapStateToProps = (state) => {
  33. console.log(state, 'mapstatetoprops');
  34. return {
  35. events: state.events,
  36. userData: state.userData
  37. };
  38. };
  39.  
  40. export default connect(mapStateToProps)(EventDashboardPage);
Add Comment
Please, Sign In to add comment