Accessing component props using triggeredById

I'm aware using eval() is discouraged


for my own better understanding :
why isn't it possible to access the clickable key of the button3 using triggeredById ?

Context: pic below + query1 is launched on button3 click :

However, when you type button3 (without quotes) on line 3, query will work.

Hi @Jan

Thanks for reaching out!

As you noted, triggeredById returns a string value, which isn't possible to key into:

Since we need the variable name, rather than a string value, we typically recommend creating a "library" of possible values for triggeredById so that it can still be used somewhat dynamically. Wish I had a better option for you, but hope this helps!

1 Like