Stacks need to interact with each other.

Good day! A question: I have two vertical stacks, both of which contain elements that repeat according to objects of $ctx collection of the main stack. I need a way for them to interact with eachother - on clicking an element from the first stack, the second stack displays only those elements, that have matching currentItem[“x”] object data. Sorry if this sounds confusing and thank you for your hard work!

I think the easiest way to do that, is to add a State Variable of type object and add a onClick handler on the main stack that updates this state to be equal to currentItem. This way, you will have access to it on the second stack

LMK if this solves it

Thanks for the reply, i created the update state variable action, but forgot to mention the second stack already has an occupied collection, i’m looking for a way to filter the elements based on matching both of their currentItem[“name”]

You can edit the repetition collection on the second stack to be something like

$ctx.collection.filter((c) =>  c.name === state.name)

If you’re not very familiar with code, you can also try clicking the blue button on the code editor and try using our AI to get this result!

ai editor? wow i didnt even know that was a thing! this product is truly incredible, i’ll make sure to recommend it to anyone i can

i’ll let you know if this works

holy crap the ai did exactly what i wanted in 5 minutes, while i’ve been struggling on my own for 2 hours, thank you!