1
const a = {"abc": 123};
const b = {
  ...a,
  "hello": "world"
}

What's wrong with this syntax? tried it in babelio got unexpected token.

Yunyi Chang
  • 159
  • 1
  • 12
  • 3
    Try this "npm install --save-dev babel-preset-stage-0" and then //.babelrc { "presets": ["stage-0"] } – Sagar Bahadur Tamang Jul 17 '18 at 06:42
  • [`...` is not an operator!](https://stackoverflow.com/questions/37151966/what-is-spreadelement-in-ecmascript-documentation-is-it-the-same-as-spread-oper/37152508#37152508) – Felix Kling Jul 17 '18 at 13:14

1 Answers1

2

The default babel env config does not handle spread operator

You need @babel/plugin-proposal-object-rest-spread

William Chong
  • 2,107
  • 13
  • 24