2 ms·
onclick: () => function_to_be_defined_at_runtime() This also lets you deal with functions that are defined at runtime. Moreover, this actually lets you provide
by dmitriid 7y ago
onclick: () => function_to_be_defined_at_runtime()
This also lets you deal with functions that are defined at runtime. Moreover, this actually lets you provide types for the expected callbacks.
> 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 https://news.ycombinator.com/item?id=20310666
This is anything but strongly typed. This is stringly typed.