|
|
|
|
|
by jcormont
2548 days ago
|
|
The onClick event handler refers to a method on an object that exists when the component is rendered, not when the template is parsed by the JS interpreter. So, to refer to the method itself you'd need to do something crazy like go through .prototype or something. Anyway, yes Typescene does let you supply an actual function in place of the string here, but for me that ruins the 'neat' flow of the view and starts mixing views with logic. |
|
> but for me that ruins the 'neat' flow of the view and starts mixing views with logic.
How is providing a reference to a function "logic"? You still provide a reference to a method, only you do it in an unspecified stringly-typed DSL.
Be sides, you're using these magical strings in so, so many places: https://news.ycombinator.com/item?id=20310666
This is anything but strongly typed. This is stringly typed.