Advertisement
Guest User

Untitled

a guest
Jan 30th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as React from 'react';
  2. import { Link, RouteComponentProps } from 'react-router-dom';
  3. import { connect } from 'react-redux';
  4. import { ApplicationState }  from '../store';
  5. import * as CounterStore from '../store/Counter';
  6. import * as WeatherForecasts from '../store/WeatherForecasts';
  7. import NavbarToggler from './NavbarToggler';
  8.  
  9. type CounterProps =
  10.     CounterStore.CounterState
  11.     & typeof CounterStore.actionCreators
  12.     & RouteComponentProps<{}>;
  13.  
  14. let props: any;
  15.  
  16. class Counter extends React.Component<CounterProps, {}> {
  17.     public render() {
  18.         return <div>
  19.             <h1>Counter</h1>
  20.  
  21.             <p>This is a simple example of a React component.</p>
  22.  
  23.             <p>Current count: <strong>{this.props.count}</strong></p>
  24.  
  25.             <button onClick={() => { this.props.increment() }}>Increment</button>
  26.  
  27.             <button onClick={() => { this.props.decrement() }}>Decrement</button>
  28.  
  29.             <NavbarToggler {...props} />
  30.             <br />
  31.             <NavbarToggler {...props} />
  32.             <br />
  33.             <NavbarToggler {...props}/>
  34.         </div>;
  35.     }
  36. }
  37.  
  38. // Wire up the React component to the Redux store
  39. export default connect(
  40.     (state: ApplicationState) => state.counter, // Selects which state properties are merged into the component's props
  41.     CounterStore.actionCreators                 // Selects which action creators are merged into the component's props
  42. )(Counter) as typeof Counter;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement