Guest User

Untitled

a guest
Dec 8th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import CounterComponent from './component';
  3. import { increase, decrease } from './action';
  4. import store from './store';
  5.  
  6. class CounterContainer extends Component {
  7. constructor(props) {
  8. super(props)
  9. this.state = {value: 0}
  10.  
  11. this.updateValue = this.updateValue.bind(this);
  12. }
  13.  
  14. componentDidMount() {
  15. store.onValueChange(this.updateValue)
  16. }
  17.  
  18. updateValue(value) {
  19. this.setState({value})
  20. }
  21.  
  22. render() {
  23. return (
  24. <CounterComponent value={this.state.value}
  25. increase={increase} decrease={decrease}
  26. />
  27. )
  28. }
  29. }
  30.  
  31. export default CounterContainer;
Add Comment
Please, Sign In to add comment