Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ferilagi-66341611's avatar

function on breackpoint inertiajs

is there any best solution for react/inertiajs for using function in diferent breakpoint

like <button ...props sm:onclick={function1} lg:onclick={function2}

....

0 likes
1 reply
MohamedTammam's avatar
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

Please or to participate in this conversation.