Invalid Arrow Function Syntax
Quick summary
Your arrow function has malformed parameters or a body that does not parse — the compiler rejects the file.
Why this happens
Omitting the arrow => between parameters and body
Using a statement block without braces, or braces without a return for an expression
Rest parameters in an invalid position or default params with wrong syntax
Minimal example
const add = (a, b) a + b; // SyntaxError: Unexpected token
console.log(add(1, 2));const add = (a, b) => a + b; // arrow added
console.log(add(1, 2)); // 3The => arrow is missing between the parameters and the body, so the parser cannot recognize the arrow function. Adding => makes it valid.
How to diagnose
Read the SyntaxError and locate the arrow function in the reported line
Verify the parameter list is wrapped in parentheses when there is more than one param
Check that the body uses either an expression or a braced block, not a mix
How to fix
Add the => arrow between the parameter list and the body
Wrap multi-statement bodies in { } and add return if a value is needed
Use parentheses around a single param for consistency and clarity
How to prevent
Use a formatter (Prettier) that normalizes arrow function syntax
Run the compiler/linter on save to catch syntax errors immediately