Skip to content

useMapContext is undefined #334

@jesuissuyaa

Description

@jesuissuyaa

I am using react-simple-maps v.3.0.0

When I use useMapContext() as instructed in the document, I am getting undefined.

Cannot destructure property 'projection' of 'useMapContext(...)' as it is undefined.
import {
  ComposableMap,
  Geographies,
  Geography,
  Marker,
  ZoomableGroup,
  useMapContext,
} from "react-simple-maps"

// ...

const MyMap = () => {
  const { projection } = useMapContext() // crashes dev app here
  
  // ...
  return (
      <ComposableMap ... >
      <ZoomableGroup>
        <Geographies geography={geoURL}>
        ...
   )
}

Are there any prerequisites to use this hook?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions