The function is as below written in TypeScript:
const handleMouseDownHome = (e: any) => {
// Only works if the scroll mouse button is clicked
if (e.button === 1) {
window.open("/", "_blank", "noopener,noreferrer");
}
};
<div onMouseDown={handleMouseDown}>
...
</div>
The url that is being used above is "/" and I would like to pass the url as a parameter so the function would be dynamic. Expected function:
const handleMouseDownHome = (e: any, url: any) => {
// Only works if the scroll mouse button is clicked
if (e.button === 1) {
window.open(url, "_blank", "noopener,noreferrer");
}
};
<div onMouseDown={<What to Modify Here>}>
...
</div>