Guest User

Untitled

a guest
Dec 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. constructor(props){
  2. super(props);
  3.  
  4. this.handleClick = this.handleClick.bind(this);
  5. }
  6.  
  7. handleClick(number){
  8. console.log("NUMERO " + number);
  9. }
  10.  
  11. <ul>
  12. {
  13. Object.keys(areas[item].childs).map(function(itemchild, ichild){
  14. return <li key={ ichild }>{ areas[item].childs[itemchild].description } <InputCounter handleClick={(number) => this.handleClick(number)} { ...areas[item].childs[itemchild] }/></li>
  15. })
  16. }
  17. </ul>
  18.  
  19. increment = () => {
  20. if(this.state.count < this.state.max_score){
  21. this.setState({
  22. count: this.state.count + 1
  23. });
  24. //Tentei passar o novo valor
  25. this.props.handleClick(this.state.count);
  26. }
  27. }
  28.  
  29. render() {
  30.  
  31. return (
  32.  
  33. <span className="input_spinner">
  34. <button onClick={ this.decrement } className={`minus ${ this.state.count === 0 ? "_disabled" : ""}`}></button>
  35. <input type="text" placeholder={ this.state.count } disabled/>
  36. <button onClick={ this.increment } className={`plus ${ this.state.count === this.state.max_score ? "_disabled" : "" }`}></button>
  37. </span>
  38. );
  39. }
Add Comment
Please, Sign In to add comment