AllenYuan

homepage - app

Apr 22nd, 2020
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3.  
  4. // extract appName from state
  5. const mapStateToProps = state => ({
  6.   appName: state.appName
  7. });
  8.  
  9. // render the appname
  10. class App extends React.Component {
  11.   render() {
  12.     return (
  13.       <div>
  14.         { this.props.appName }
  15.       </div>
  16.     );
  17.   }
  18. }
  19.  
  20. // export redux-connected App
  21. export default connect(mapStateToProps, () => ({}))(App);
Advertisement
Add Comment
Please, Sign In to add comment