Disable switch button in React
Disable switch button in React If I click on the Annual radio button, then switch button (labelled "half day") should be hidden or disabled (only for Annual radio button). How do I do this in React? <RadioGroup onChange={this.onChange} value={this.state.leavevalue}> <Radio value={1}>Casual</Radio> <Radio value={2}>Medical</Radio> <Radio value={3}>Annual</Radio> <Radio value={4}>Lieu</Radio> <Radio value={5}>Special</Radio> <Radio value={6}>Maternity</Radio> <Radio value={7}>Paternity</Radio> <Radio value={8}>NoPay</Radio> </RadioGroup> This is my switch button code : <Switch onChange={this.handleHalfDay} checked={this.state.isHalfDay} /> This is my onChange function: onChange = (e) => { this.setState({ leavevalue: e.target.value, isHalfDay: false, }); } My radio buttons and the switch button: ...