4 ms·
Using braces in an arrow function that returns an object literal actually is ambiguous in JS, which is why you have to wrap it in parentheses, e.g.: const fo
by throwitaway1123 2y ago
Using braces in an arrow function that returns an object literal actually is ambiguous in JS, which is why you have to wrap it in parentheses, e.g.:
const foo = () => ({foo: 'bar'})
If you omit the parentheses it gets interpreted as a block with a label and a string literal:
const baz = () => {baz: 'bar'}
https://astexplorer.net/#/gist/9a86e0b61fda312dce2ea9d10d37ff20/8e2d1443456d0a4724f24b18ae2f97b585c3bc03 https://astexplorer.net/#/gist/9a86e0b61fda312dce2ea9d10d37f...