IonTab onClick handler not working - Ionic React

Elvis Duru

Elvis Duru / April 27, 2022 

1 min read --- views

This is a quick article written to help those who encounter an issue when you try passing a function handler to the onClick prop present in the IonTab component but it doesn’t get called as expected.


Use the onIonTabsWillChange prop on the IonTabs component to call the function:

const openModal= () => {
	// do something cool

  onIonTabsWillChange={(e) => {
		if ( === "tabName") {
	    // call function here
	<IonTabButton tab="tabName">


If you’re reading this, I hope this solution worked for you. You can also check out other articles I have on my blog. Happy coding!

Get the latest articles, in your inbox

Every couple of weeks, I share the best content from my blog. It's short, sweet, and practical. I'd love you to join. You may opt out at any time.