I'm trying to enable the spread operator in my project using Babel, but since Babel has remove stage presets I'm having no luck getting spread operators to work with: https://www.npmjs.com/package/@babel/plugin-proposal-object-rest-spread
I've installed plugin-proposal-object-rest-spread and added it to my .babelrc:
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
But I'm still getting the following error:
Support for the experimental syntax 'objectRestSpread' isn't currently enabled
(28:3):
26 | onClick,
27 | text,
> 28 | ...allProps
| ^
29 | }) => {
30 | let Element = isStatic ? 'span' : renderAs;
31 | const props = modifiers.clean(allProps);
Add @babel/plugin-proposal-object-rest-spread (https://git.io/vb4Ss) to the 'plugins' section of your Babel config to enable transformation.
It suggests I add @babel/plugin-proposal-object-rest-spread. I have, it's in my package.json.
Any ideas?