Typescript and react are used.
Markers are displayed at the clicked position using google-map-react.
The following error occurs when passing a Marker component to GoogleMapReact with children.
Please let me know if you know how to solve this problem.
error
(alias) class GoogleMapReact (alias) namespace GoogleMapReact import GoogleMapReact No overloads match this call. Overload 1 of 2, '(props: Props | Readonly): googleMapReact', caused the following error type '{ children: Element; bootstrapURLKeys: { key: string; }; defaultCenter: { lat: number; lng: number; }; defaultZoom: number; onClick: (e: ClickEventValue) => void; }' cannot be assigned to types 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'. Property 'children' does not exist for type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.
Overloading 2 of 2, '(props: Props, context: any): googleMapReact', caused the following error type '{ children: Element; bootstrapURLKeys: { key: string; }; defaultCenter: { lat: number; lng: number; }; defaultZoom: number; onClick: (e: ClickEventValue) => void; }' cannot be assigned to types 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'. Property 'children' does not exist for type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.
import GoogleMapReact from 'google-map-react';
export const Area = () => {
const defaultLatLng = {
lat: 10.99835602,
lng: 77.01502627,
},
return (
<Box height="340px">
<GoogleMapReact
bootstrapURLKeys={{ key: Key }}
defaultCenter={defaultLatLng}
defaultZoom={10}
>
<Maker lat={59.955413} lng={30.337844} />
</GoogleMapReact>
</Box>
)
}
interface SubProps {
lat: number;
lng: number;
}
const Maker: FunctionComponent<SubProps> = () => <img src="location.svg"} />