I am learning React-typescript. I am using react google maps to show my area. I successfully able to display the map. When I tried to use Marker from react-google-map to point out my area and positioned my latitude and longitude. I am getting typescript error: Property 'position' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<GoogleMapReact> & Readonly<Props> & Readonly<...>
. I really don't know how to fix it.
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import ErrorBoundary from 'components/errorBoundary';
import GoogleMapReact from 'google-map-react';
import Marker from 'google-map-react'
export interface ITestNewListProps {
className?: string;
position?: { lat: number; lng: number; };
}
const TestMaps = ({ className, position }: ITestNewListProps) => {
const [state, setstate] = useState(
{
center: {
lat: 60.1098678,
lng: 24.7385084
},
zoom: 7
}
)
return (
<ErrorBoundary id="TestNewListErrorBoundary">
<div className={`${className}`}>
<div style={{ height: '100vh', width: '100%' }}>
<GoogleMapReact
bootstrapURLKeys={{ key: "*************************" }}
defaultCenter={state.center}
defaultZoom={state.zoom}
>
<Marker position={{ lat: 60.1098678, lng: 24.7385084 }} />//Geting error from here
</GoogleMapReact>
</div>
</div>
</ErrorBoundary>
);
};
TestMaps.displayName = `test`;
export default styled(TestMaps)`
`;