Module parse failed: Unexpected token (110:28)

Viewed 39

I have this error when I write a block scope function.

Failed to compile

./src/components/PlaceDetails/PlaceDetails.jsx 110:28 Module parse failed: Unexpected token (110:28) You may need an appropriate loader to handle this file type. | columnNumber: 21 | } }, place.ranking)), place?.cuisine?.map(function (_ref2) { | var name = _ref2.name; | return /#PURE/React.createElement(Chip, {

this is my function: I use Travel Advisor api, 'place' is data from this api. cuisine its array.

                {place?.cuisine?.map(({name})=> (
                <Chip key ={name} size='small' label={name} className='chip' />
            ))}
1 Answers

It seems you are using the babel/react scripts versions that are not supporting Optional chaining (?). Make sure that you have the following versions installed.

  1. Create React App ≥ 3.3.0
  2. Babel ≥ 7.8.0
  3. TypeScript ≥ 3.7
Related