Here is the code where I have included spread operator
style={{ ...styles.detailsRow.icon, alignSelf: 'centre' }}
What things do I need to install or add to make it run?
And also what is its equivalent in es2015
?
Here is the code where I have included spread operator
style={{ ...styles.detailsRow.icon, alignSelf: 'centre' }}
What things do I need to install or add to make it run?
And also what is its equivalent in es2015
?
You need to configure Babel to use the transform-object-rest-spread plugin. Refer to the following link for details: https://babeljs.io/docs/plugins/transform-object-rest-spread/
You are missing one babel preset, stage-0
npm install --save-dev babel-preset-stage-0
if you have .bablerc
file add following to it.
{
"presets":[
"es2015", "react", "stage-0"
]
}
Or added to webpack config in loader.
I had the same problem, and the fix I found was to add experimentalObjectRestSpread
to the ecmaFeatures
setting in .eslintrc
:
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
}