Interactivity API should have a method to access root context when using wp-each directive #65770
sethrubenstein
started this conversation in
Interactivity API
Replies: 1 comment 8 replies
-
Out of curiosity, what’s the reason you can’t access |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I'm proposing is a new function in the api,
getRootContext
. This would return the context of the current elements root element, so one interactive element up.Take this example of using
wp-each
directive:And consider this view.js
What if there was a
getRootContext
function, that would return the context of the root element? This would be useful for more than just in wp-each, I could see myself using this to get the content of the interactive namespace one element up, and so on (without getting too ridiculous). This would allow a little more broader use of context vs global state. Ideally you would also be able to set the root element's context as well not just read.Beta Was this translation helpful? Give feedback.
All reactions