Trevor Sullivan
Trevor Sullivan•17mo ago

Use tab selection as trigger?

I'm using a tab component to host a "multi-page" app. Can I run some front-end code when a different tab is selected ... in other words, the selectedTabIndex changes?
5 Replies
Sindre
Sindre•17mo ago
that was discussed a few days ago, ruben mention that that was not possible. 2 workarounds 1. this is porp a very bad idea, but use setInterval on a shortInterval and check if its a new tab.... 2. use the invisible tabs, create a dropdown to go between and react on the change of that state. This is prop a good idea.
rubenf
rubenf•17mo ago
Wait wait, you can just have code that use selectedTabIndex as input and run on any input changes Did I say it was not possible ?
Sindre
Sindre•17mo ago
I thought you did, now I need to search for an hour to prove I'm not lying 😛 But selectedTabIndex as input makes more sense yeah.
Trevor Sullivan
Trevor SullivanOP•17mo ago
I like idea #2!! That ought to work well. So essentially build a custom nav system, rather than using the default tabs. Sorry if this is a dupe. I remember discussing setInterval, but that was a different use case.
Sindre
Sindre•17mo ago
yeah, I was trying to search but gave up, so I guess I have just started dreaming about windmill and ruben in my sleep....