Decrale your modal component. It receive props, message, exec and cancel.
message is a type of strings will be shown in modal.
exec is a type of functions will execute a process which you want to confirm.
cancel is a type of functions will close your modal.
functionModal({message,exec,cancel}){
return(
<div
style={{
width:"700px",
height:"400px",
margin:"0 auto",
backgroundColor:"white"
}}
>
<h1>{message}</h1>
<buttononClick={exec}>Yes</button>
<buttononClick={cancel}>No</button>
</div>
);
}
Wrap your application component with ConfirmModalProvider, And pass your modal component as Component props.
(And you can pass custom overlay component as Overlay props.)