Getting this error, but unlike other posts I've found on stack overflow, it isn't due to the fact that the spread operator doesn't appear last. In fact, it occurs because of the trailing comma:
const SlashedPrice = ({
price,
currencySymbol,
...props,
}) => {
When I remove the comma from ...props
, the error goes away. At first, I thought this was an issue with babel, but I've included 2 new rules with no luck: "@babel/plugin-proposal-object-rest-spread"
and "syntax-trailing-function-commas",
At this point I am at a loss as to what is causing the issue. Where can I begin looking to debug?
Background: Everything in my codebase was working fine, until I removed node_modules and reran yarn install
.
The problem is that, when you let the comma after the ...props
, the props
isn't the last item anymore. The ...props
is the Rest
that the error is talking about. It has nothing to do with babel.
Reference here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With