I have the following function in the React component that runs when a link is clicked:
onClick(e, { name }) {
e.stopPropagation();
const doIt = await checkSomething();
if (doIt) {
e.preventDefault();
doSomethingElse();
}
}
The problem is that by the time it reaches the e.preventDefault()
synthetic event is being processed. So, how can I tell the browser not to follow the link if it is clicked, when some logic is needed to calculate this solution and before the synthetic event is processed?
source
share