Guest User

Untitled

a guest
Nov 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. 'use strict';
  2.  
  3. import React, { Component } from 'react';
  4. import { Route, Link, withRouter } from 'react-router-dom';
  5. import { connect } from 'react-redux';
  6.  
  7. import Home from './Home/Home';
  8. import About from './About/About';
  9.  
  10. function mapStateToProps(store, props) {
  11. return {
  12. alert: store.alert,
  13. weather: store.weather,
  14. weatherCities: store.weatherCities
  15. }
  16. }
  17.  
  18. class App extends Component {
  19. constructor() {
  20. super();
  21. }
  22.  
  23. render() {
  24. return <div className="app">
  25.  
  26. <ul className="app-navigation">
  27. <li><Link to="/">Home</Link></li>
  28. <li><Link to="/about">About</Link></li>
  29. </ul>
  30.  
  31.  
  32. <Route exact path="/" render={ () => <Home {...this.props} /> } />
  33. <Route path="/about" render={ () => <About {...this.props} /> } />
  34. </div>
  35. }
  36. }
  37.  
  38. export default withRouter(connect(mapStateToProps)(App));
Add Comment
Please, Sign In to add comment