Skip to content

Deprecation: nonstandard template literals

Taylor Hunt edited this page Aug 2, 2019 · 1 revision

Marko’s nonstandard template literals are deprecated in favor of standard JavaScript template literals.

Migrating to the new syntax should be as straightforward as replacing quotes:

<div class="${input.classA} ${input.classB}"/>

…with backticks:

<div class=`${input.classA} ${input.classB}`/>

There was also a slight quirk with nonstandard template literals that held a single expression. This was treated as passing the value through as-is:

<my-component number="${1}" variable="${foo}"/>

To match this old behavior, pass the value without any surrounding quotes:

<my-component number=1 variable=foo />