npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nomadle/rescript-world-map

v0.1.0

Published

ReScript bindings for react-world-map

Readme

@nomadle/rescript-world-map

ReScript bindings for react-world-map - a simple, interactive SVG world map component for React.

Installation

npm install @nomadle/rescript-world-map react-world-map
# or
pnpm add @nomadle/rescript-world-map react-world-map

Add to your rescript.json:

{
  "bs-dependencies": ["@nomadle/rescript-world-map"]
}

Usage

Basic Example

open ReactWorldMap

@react.component
let make = () => {
  let (selected, setSelected) = React.useState(() => None)

  <WorldMap
    selected={selected}
    onSelect={continent => {
      let parsed = ReactWordMapTypes.continentFromString(continent)
      setSelected(_ => parsed)
    }}
  />
}

With Continent Type Helpers

open ReactWorldMap

@react.component
let make = () => {
  let (selected, setSelected) = React.useState(() => None)

  let handleSelect = continentString => {
    switch ReactWordMapTypes.continentFromString(continentString) {
    | Some(continent) => {
        setSelected(_ => Some(continent))
        Js.log("Selected: " ++ ReactWordMapTypes.continentToFullName(continent))
      }
    | None => Js.log("Unknown continent")
    }
  }

  let selectedCode = selected->Option.map(ReactWordMapTypes.continentToString)

  <div>
    <WorldMap selected={selectedCode} onSelect={handleSelect} />
    {selected
    ->Option.map(continent =>
      <p>{("Selected: " ++ ReactWordMapTypes.continentToFullName(continent))->React.string}</p>
    )
    ->Option.getOr(React.null)}
  </div>
}

Multiple Selection Mode

open ReactWorldMap

@react.component
let make = () => {
  <WorldMap
    multiple=true
    onSelect={continent => Js.log("Selected: " ++ continent)}
  />
}

Props

These props mirror the underlying react-world-map API:

| Prop | Type | Description | |------|------|-------------| | selected | string | The currently selected continent code, e.g. "na" (optional) | | onSelect | string => unit | Callback when a continent is clicked | | multiple | bool | Allow multiple selections in uncontrolled mode (optional) |

Note: The binding stays faithful to the original JS component. If you use a custom wrapper that accepts selectedContinent, onHover, onMouseLeave, or className, that logic belongs in your application layer, not in this binding.

Continent Types

The ReactWordMapTypes module provides type-safe helpers for working with continent codes:

  • continent - A polymorphic variant type for continents:

    • #NorthAmerica ("na")
    • #SouthAmerica ("sa")
    • #Africa ("af")
    • #Europe ("eu")
    • #Asia ("as")
    • #Oceania ("oc")
  • continentFromString(string) - Parse a string to a continent option

  • continentToString(continent) - Convert a continent to its code

  • continentToFullName(continent) - Convert a continent to its full name

License

MIT