In version 16, Angular released signals. A reactive primitive promised by the core team that would help take the framework to the next level. A pri...
For further actions, you may consider blocking this person and/or reporting abuse
Great article Robin! To elaborate on why options is returned from a function, this also allows to preserve expressions. JavaScript - like most languages, is eagerly evaluated. The only practical way to preserve expressions is to wrap them in a function.
Which allows code like this:
Which means the query will be automatically enabled for you whenever the postId signal value is greater than 0. No need to separately define and pass a computed signal. This works for all the query properties.
If it becomes more complex than a simple comparison or maybe a ternary I would recommend a separate computed for code readability though.
Thanks so much! Is it cool if I add this as a paragraph in the article?
Yes of course!