I'm using mobx and I have multiple modals like "menuModal" , "feedbackModal", "reviewModal" and couple few more . For each modal I have a state "isMenuModalOpen", "isFeedbackModalOpen", "isReviewModalOpen". Depending on state modals open or close. And for each state I have a function that toggles state on click. Is that possible to use just one function and one state to handle all this modals.
@observable public isFeedbackModalOpen = false
@observable public isReviewModalOpen = false
@observable public isMenuModalOpen = false
@action.bound
public menuModalToggle() {
this.isMenuModalOpen = !this.isMenuModalOpen
}
@action.bound
public feedbackModalToggle() {
this.isFeedbackModalOpen = !this.isFeedbackModalOpen
}
@action.bound
public feedbackModalToggle() {
this.isReviewModalOpen = !this.isReviewModalOpen
}
onClick={() => {
this.props.store.modal.feedbackModalToggle()
}}