How to get an alert message when the user tries to change the option?

I am having 3 options in the dropdown and they had they have their respective objects. When I click on the options their object will appear in the popup
An add button enables me to add few more objects under the same option. I want to display an alert message when I try to change the option after selecting few objects in one option. How can I do that?

onAddClicked = () =>{
            showOptions: true
<button type="button" onClick={this.onAddClick}
   style={{ float: "right",  marginLeft: "10px", marginRight: "10px" }}
    className={((this.state.selectedOptions ?this.state.selectedOptions.length === 0 : true) ? 
    "re-btn-primary-inactive" : "re-btn-primary-blue")}disabled={(this.state.selectedOptions ? 
    this.state.selectedOptions.length === 0 : true) ? true : false}>Add 

I can select and option and few objects under it. Now I need to display an error message when I want to change my option after selecting few objects under that. I am having state for my selected options as “this.state.selectedOptions”. I am trying this inside my function

if(this.state.selectedOptions ? this.state.selectedOptions.value : null)
          alert("selectedOptions value has changed");

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.