I'm using react and I'm trying to use the spread syntax. For some reason it doesn't work and it gives an error:
const { className, children, ...otherprops } = this.props;
Any idea what I'm doing wrong?
I'm using react and I'm trying to use the spread syntax. For some reason it doesn't work and it gives an error:
const { className, children, ...otherprops } = this.props;
Any idea what I'm doing wrong?
You are getting Unexpected token
because you are missing one babel preset, stage-0
Without stage-0, it doesn't work
In order to add it, you have to
1º Install it
npm install --save-dev babel-preset-stage-0
2º Add it to .babelrc
{
"presets": ["react","es2015","stage-0"]
}