handleFemaleClick = () => {
this.setState({ gender: 1, femaleSelected: true, maleSelected: false });
}
handleMaleClick = () => {
this.setState({ gender: 2, femaleSelected: false, maleSelected: true });
}
<button onClick={() => this.handleFemaleClick()} style={{ background: this.state.femaleSelected ? 'red' : 'green' }}>Female</button>
<button onClick={() => this.handleMaleClick()} style={{ background: this.state.maleSelected ? 'red' : 'green' }}>Male</button>