0

I have input component and checkbox component which both are close in other component which is repeat x times. How can I change value in input component when my checkbox will be selected?

resetValue(){
 this.props.value = 45;
 }

return( 
 <div> 
   <InputComponent value={this.props.value}/>
   <CheckboxComponent onChange={this.resetValue}/>
 </div>
)
yazpid
  • 135
  • 2
  • 18
  • 2
    possbile duplicate https://stackoverflow.com/questions/21285923/reactjs-two-components-communicating – CharanRoot Jun 07 '17 at 14:16
  • 1
    Never, ever, mutate the `props` directly. – Chris Jun 07 '17 at 14:19
  • 2
    Possible duplicate of [ReactJS Two components communicating](https://stackoverflow.com/questions/21285923/reactjs-two-components-communicating) – Chris Jun 07 '17 at 14:19

0 Answers0