-
Hello, I’m encountering an issue with the Here’s the relevant code: Map component: export const AppMap = ({ classNames, children, ...restProps }: MapProps): ReactElement => {
return (
<APIProvider apiKey={mapConfig.apiKey ?? ''} libraries={['marker']}>
<Map className={classNames?.base} {...mapConfig} {...restProps}>
{children}
</Map>
</APIProvider>
);
}; Usage of Map component on the first page: <AppMap
defaultCenter={{ lat: item.latitude, lng: item.longitude }}
classNames={{ base: styles.location__map }}>
<MapMarker position={{ lat: item?.latitude, lng: item?.longitude }} />
</AppMap> Usage of Map component on the second page: <AppMap
defaultCenter={mapCoordinates}
onCameraChanged={handleChangeCenter}
classNames={{ base: styles.locationstep__map }}>
{location?.latitude && location?.longitude && (
<MapMarker position={{ lat: location.latitude, lng: location.longitude }} />
)}
</AppMap> MapMarker component: export const MapMarker = ({ position, label, onClick, classNames, iconName }: MarkerProps): ReactElement => {
return (
<AdvancedMarker className={styles.marker} position={position} onClick={onClick}>
<div className={clsx(styles.marker__badge, classNames?.badge)}>
<Icon name={iconName || 'anchor_fill'} theme='light' />
</div>
{label && <div className={styles.marker__label}>{label}</div>}
</AdvancedMarker>
);
}; Any guidance on why this error might be occurring and how to resolve it would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Have a look here: #225 – that should at least explain where this error comes from and some tips to debug it. |
Beta Was this translation helpful? Give feedback.
-
I would think that moving the |
Beta Was this translation helpful? Give feedback.
While setting up an example I’ve discovered that the issue was caused by the
useLoadScript
function from the@react-google-maps/api
library, which was used in one of my wrapper components. After removing its usage, the problem no longer occurs 🤔