i want to use this function with arrow function :
getGeolocation = () => {
const options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0,
};
const success = pos => {
const { latitude, longitude } = pos.coords;
this.setState({
location: {
lat: latitude,
lng: longitude,
},
});
};
function error(err) {
console.warn(`ERROR(${err.code}): ${err.message}`);
}
const geolocation = navigator.geolocation.getCurrentPosition(
success,
error,
options
);
return geolocation;
};
and my error looks like this:
Module build failed: SyntaxError: Unexpected token (112:17) getGeolocation **[=][1]** () => {
Any ideas what the problem might be?
Running on "webpack": "3.6.0", es2015