Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor(props){
- super(props);
- this.handleClick = this.handleClick.bind(this);
- }
- handleClick(number){
- console.log("NUMERO " + number);
- }
- <ul>
- {
- Object.keys(areas[item].childs).map(function(itemchild, ichild){
- return <li key={ ichild }>{ areas[item].childs[itemchild].description } <InputCounter handleClick={(number) => this.handleClick(number)} { ...areas[item].childs[itemchild] }/></li>
- })
- }
- </ul>
- increment = () => {
- if(this.state.count < this.state.max_score){
- this.setState({
- count: this.state.count + 1
- });
- //Tentei passar o novo valor
- this.props.handleClick(this.state.count);
- }
- }
- render() {
- return (
- <span className="input_spinner">
- <button onClick={ this.decrement } className={`minus ${ this.state.count === 0 ? "_disabled" : ""}`}></button>
- <input type="text" placeholder={ this.state.count } disabled/>
- <button onClick={ this.increment } className={`plus ${ this.state.count === this.state.max_score ? "_disabled" : "" }`}></button>
- </span>
- );
- }
Add Comment
Please, Sign In to add comment