-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow context.variable.function in a component context. #697
Comments
The context is parsed into a JSON object and functions can not be represented in JSON as far as I know. I investigated this in #539 a bit (since I would love to have this for React projects) but concluded that this is probably not going to happen because of the JSON requirement. If you have any ideas on how to implement this without a breaking change, I'm all ears. |
would something like this work?
from: https://stackoverflow.com/questions/36517173/how-to-store-a-javascript-function-in-json |
Not really - that technique is a bit hacky in the sense that it's basically a workaround for what JSON does not support. Additionally, the |
Can it be supported that functions will work in the component context object.
module.exports = { context: { comeVariableName: { someFunction: function(param){ return "value"; } } } }
it can work in the same way as normal variables in terms of rendering the value.
Its so we can use the syntax in twig.
The text was updated successfully, but these errors were encountered: