#todayilearned

by @jm3 · aka John Manoogian3

Frequent, bite-size mini-milestone updates as I fast-forward merge* my front-end web development skills up to 2019 levels. Learn more

Vue's magical key mapping

Posted at — Jun 3, 2019

Due to JS limitations (i.e., keys need to be valid JS identifiers, ie. unambiguous barewords or quoted strings), so you can’t use “kebab case” on the left hand side of a bind object expression; it owuld look to the browser’s JS parser like string subtraction (hummus-peppers). So, Vue helpfully and silently accepts camelCase keys instead, and then evaluates them to dash-case syntax for you (ie: fontSize will become font-size). Cool but magical.

Read more