I have a function:
handleMarkerClick(targetMarker) {
this.setState({
markers: this.state.markers.map(marker => {
if (marker === targetMarker) {
return {
...marker, // error TS1136: Property assignment expected.
showInfo: true, // error TS1005: ',' expected.
}; // error TS1135: Argument expression expected, error TS1005: ')' expected.
}
return marker; // error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
}), // Declaration or statement expected.
});
}
and I see many errors:
- Property assignment expected.
- ',' expected.
- Argument expression expected.
- You may need an appropriate loader to handle this file type. | exports.__esModule = true; | exports["default"] = PopUpInfoWindowExample; | return marker;
But when I delete '...' near 'marker' my function wasn't work correct.
I do this:
handleMarkerClick(targetMarker) {
this.setState({
markers: this.state.markers.map(marker => {
if (marker === targetMarker) {
return {
marker, // delete ...
showInfo: true,
};
}
return marker;
}),
});
}
Why? What I can do to get right function?
markera string?targetMarkeran array? What is expected result ofmarker === targetMarkerand...marker?