in React, I taught that the hook componentWillUnMount() is the ideal case to put the prompt as it detects all the various way the component will be un mounted
If I understand you, you are misunderstanding componentWillUnmount(). That is called by React just before your component unmounts. You don’t put things in there that will cause your component to unmount. You put things in there that you want to happen before you unmount. For example if you had some timers that you wanted to clear or if you wanted to make sure your database was in a good state before you left. It is used for cleanup. Most of the time you don’t need it.
If you want a “prompt” like a button to go somewhere else, then just have the navigation action or the anchor on that button. React will automatically call CWUM and if you have any cleanup work you need, that is where you would put it.