|
|
|
|
|
by tracker1
1205 days ago
|
|
To me, the single best example, is a function that turns a template into a parameterized query, and then makes an async database request... var result = await query`
SELECT * FROM foo.bar where baz = ${baz}
`;
There are libraries that allow for construction of queries as well using template strings. I don't know of too many instances beyond this where there's custom functions for tagged templates, vs just string building with parameters. |
|
It's nifty, but not nearly better enough to justify its existence, IMO. Here's the alternative:
I get it... there's that extra level of indirection. But people are working hard, as we speak, to abuse the feature.