So in my app, I have 3 text links: Info, payment, and support. Whenever the user clicks on any of these texts, a particular group is shown. By default, the info group is shown and the other two groups are hidden, so I have underlined the Info text to indicate that the Info group is being shown. When the user clicks on payment or support text, I want to change the style of the links i.e I want the selected link to be underlined now. How can I achieve this?
Hi there, @shardul… one way you could accomplish what you have described is to use a custom state, but if you do, the user’s selection won’t be “remembered” when the page is refreshed. So, the way I might go about it is to have a field on the
User data type that changes when the user clicks a link, and then you can use that field to change the text and show/hide the groups.
For example, you could have a field on the
User data type called
selected link, and that field could be a number. When the user clicks Info, Payment, or Support, you would make a change to the user and set the value of that field to 1, 2, or 3, respectively. Then, you would have conditionals on the links to underline them when a user’s
selected link value is a certain number, and you would show the appropriate group based on the same conditionals.
Anyway, that’s one way to go about it, and I hope this helps.