-
-
Save getify/105df0a0c17892243a37c4fced1d3a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.