That syntax is an experimental proposed syntax for the future, it is not part of es2015
or react
so you’ll need to enable it.
npm install --save-dev babel-plugin-transform-object-rest-spread
and add
"plugins": ["transform-object-rest-spread"]
into .babelrc
alongside your existing presets
.
Alternatively:
npm install --save-dev babel-preset-stage-3
and use stage-3
in your presets to enable all stage-3 experimental functionality.