-
Hello 👋 Suppose I have a feature state such as
In the feature's view I can derive a binding to each of the properties by using $store.property1.sending(\.someAction) with analogous lines for properties 2 and 3 but can I do this more generically, by referencing those properties and actions through key-paths, something along the lines of one of these? $store[keyPath: propertyKeyPath].sending(actionCasePath)
$store.state[keyPath: propertyKeyPath].sending(actionCasePath) I've managed to abstract away the action but not the state. It seems that I can only derive a binding by explicitly specifying the property I want a binding for. Thanks in advance for any replies. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hi @wltrup, the syntax $store[dynamicMember: \.property1] So you should be able to do: $store[dynamicMember: propertyKeyPath].sending(actionCasePath) Can you let me know if that works? |
Beta Was this translation helpful? Give feedback.
Hi @wltrup, the syntax
$store.property1
is unlocked by@dynamicMemberLook
, and technically desugars to:So you should be able to do:
Can you let me know if that works?