Syntaxerror Unexpected Token, Expected ","
I have that error: SyntaxError Unexpected token, expected ',') Code: render() { const {collections} = this.state; return (
Solution 1:
Parentheses are needed around destructured parameters.
({ id, ...otherCollectionProps }) => ()
You should also return the JSX with either return
or with simple parentheses as well (instead of curly braces).
const { collections } = this.state;
return (
<divclassName="shop-page">
{collections.map(({ id, ...otherCollectionProps }) => {
return <PreviewCollectionkey={id} {...otherCollectionProps} />;
})}
</div>
);
Post a Comment for "Syntaxerror Unexpected Token, Expected ",""