Level 51
Best? I don't know. But here's one
Use one function and add condition in it
<button ...props onclick={callback}>...</button
function callback() {
if(window.innerWidth <= yourBreakPoint) {
function1();
} else {
function2();
}
}
1 like