this.setState({ eng_oneoff_eldwelc: !this.state.eng_oneoff_eldwelc }, () => {
this.counter( this.state.eng_oneoff_eldwelc, 'OneOffPSCount' );
})
export class CheckBox extends React.Component {
constructor(props) {
super(props);
this.state = {
firstCheckBox: false,
secondCheckBox: false
}
}
counter(stateField){
const newState = {};
newState[stateField] = !(this.state[stateField]);
this.setState(newState);
}
render() {
return (<div>
<input type="checkbox" checked={this.state.firstCheckBox} label="First checkbox" onChange={this.counter.bind(this, 'firstCheckBox')} />
<input type="checkbox" checked={this.state.secondCheckBox} label="Second checkbox" onChange={this.counter.bind(this, 'secondCheckBox')} />
</div>)
}
}
export class CheckBox extends React.Component {
constructor(props) {
super(props);
this.state = {
eng_oneoff_patwaitappoint: false,
OneOffPSCount: 0
}
}
counter(cond, stateField){
const newState = {};
if(cond === true) {
newState[stateField] = this.state[stateField] + 1;
this.setState(newState);
} else {
newState[stateField] = this.state[stateField] - 1;
this.setState(newState);
}
}
render() {
return (
<input type="checkbox" checked={this.state.eng_oneoff_patwaitappoint} label="Patient waiting for Appointment" onChange={this.counter.bind(this, !this.state.eng_oneoff_patwaitappoint,'eng_oneoff_patwaitappoint')} />
)
}
}