Skip to content

Instantly share code, notes, and snippets.

@getify
Last active November 4, 2016 14:39
Show Gist options
  • Save getify/105df0a0c17892243a37c4fced1d3a8b to your computer and use it in GitHub Desktop.
Save getify/105df0a0c17892243a37c4fced1d3a8b to your computer and use it in GitHub Desktop.
// All of the following are ways that template literals are *NOT* `strictly better` than " or ' delimited strings
// RE: https://ponyfoo.com/articles/template-literals-strictly-better-strings
// valid syntax, but doesn't turn on strict mode
`use strict`;
// invalid syntax
const x = { `hello world`: 42 };
// invalid syntax
const { `hello world`: a } = x;
// invalid syntax
import foo from `foo.js`;
@evandavis
Copy link

I have to agree with @getify. I ran --fix on my React repo and was surprised by how many strings were not converted: module imports would be invalid, and JSX props require a {} wrapper around template literals.

For now, it's easier (for me) to just use backticks when I need the features of a template literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment