Skip to content

Error: [react-leaflet-component-marker] Expected marker with id 'marker-:r9:' to be rendered, but none was found. #1

Closed
@fluse

Description

@fluse

i got this error

Expected marker with id 'marker-:r9:' to be rendered, but none was found.

import { Marker as LeafletMarker } from '@adamscybot/react-leaflet-component-marker'
import { useRouter } from 'next/router'
import { StyledPin } from './styles'

const StyledMarker = ({ uid }) => {
  const router = useRouter()
  const goToRoute = () => {
    router.push(`/locations/${uid}`)
  }

  return (
    <>
      <StyledPin onClick={goToRoute}>&nbsp;</StyledPin>
    </>
  )
}

interface CustomMarkerProps {
  id: string
  uid: string
  lng: number
  lat: number
}

const Marker: React.FC<CustomMarkerProps> = ({ lng, lat, ...rest }) => {
  return (
    <LeafletMarker
      icon={<StyledMarker {...rest} />}
      position={[lat, lng]}
    />
  )
}

export default Marker

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions