6 ms·
Niiice! I finally understand the origin of this JS syntax used in SQL queries and GraphQL: sql`SELECT * FROM users WHERE id = ${userId}` const q = gql` quer
by rriley 8mo ago
Niiice! I finally understand the origin of this JS syntax used in SQL queries and GraphQL:
sql`SELECT * FROM users WHERE id = ${userId}`
const q = gql`
query GetUser {
user(id: ${userId}) {
name
email
}
}
`;
- jazzypants 8mo agoThey're called "tagged template literals". Here's the docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...