question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Most basic example won't work on latest version

See original GitHub issue

Hello, I wanna use react-simple-maps with Typescript. Since types are defined for 0.12+ versions only I am forced to use the latest versions of the library (0.12.1). Trying to do so results in an error, presumably because the render props passed by Geographies has changed. Trying to console.log those props returned an empty array.

Please see this example: https://codesandbox.io/s/basic-map-s4cdv?fontsize=14&hidenavigation=1&theme=dark

Note that the only difference from the original example is the version specified in package.json.

I couldn’t find any explanation about the latest version and how to use it on the website/docs.

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zimrickcommented, Nov 25, 2019

That’s cool @Amiryy,

If you are using v1, the disableOptimization prop is no longer in use. It was a bit of a confusing feature of rsm that has been solved differently in v1, so the prop has been retired.

1reaction
zimrickcommented, Nov 25, 2019

Hi @Amiryy,

The documentation as well as all the old examples are still available in the repo under the v0.12.x branch.

There is one additional change in the API from v0.12 to v1, and that is that v0.12 returns the geographies, and v1 returns an object, which contains geographies, projection, and path. so the difference is that in v1 you can use destructuring to get the geographies, and in v0.12 you just get the geographies directly. Note that v0.12 also does not have an rsmKey for the geographies, so you will have to make a unique id (based off iso code, or something else unique for every country).

// v0.12
<Geographies geography={geoUrl}>
  {(geographies) =>
    geographies.map(geo => <Geography key={geo.id} geography={geo} />)
  }
</Geographies>

// v1
<Geographies geography={geoUrl}>
  {({ geographies }) =>
    geographies.map(geo => <Geography key={geo.rsmKey} geography={geo} />)
  }
</Geographies>

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 Troubleshooting: The Most Common Problems ...
Issues updating to the latest version of Windows 10 · Not enough storage space to complete an update · Mouse cursor starts moving...
Read more >
Fix program errors and improve code - Visual Studio (Windows)
This article describes some basic ways Visual Studio can help you find and fix problems in your code, including build errors, code analysis, ......
Read more >
Best practices for writing Dockerfiles - Docker Documentation
Best practices for writing Dockerfiles. This document covers recommended best practices and methods for building efficient images.
Read more >
Unable to Install Apps or Software on Windows? Here's What ...
If you're unable to install software on Windows 10 or Windows 11, here's how to fix common app installation problems.
Read more >
10 Common WordPress Theme Issues & How To Fix Them
Common WordPress errors with solutions. We address some of the most common WordPress theme issues and provide easy solutions to fix them.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found