react-maps
                                
                                 react-maps copied to clipboard
                                
                                    react-maps copied to clipboard
                            
                            
                            
                        React-map is a collection of Map Components of Countries and Continents that can be used to create interesting map interactions in your website !
REACT-MAPS
Create beautiful,interactive maps with a vivid collection of over 200+ maps ranging from countries, continents and others!
Drop of a ✨ if you are here. It would mean a lot : )
Features
- Wide range of maps (239 to be exact )
- Very small dependency size ( Largest map is less than 800kB )
- Easy to use components!
Installation
Navigate to your favourite map component and install it in your react project using
npm install @react-map/{your_country}
That is it! you are now ready to use the map components.
Usage
Each component you add has a fixed 6 parameters that you can use to tweek around the map's behaviour.
export interface props = {
  size?: number;
  mapColor?: string;
  strokeColor?: string;
  strokeWidth?: number;
  hoverColor?: string;
  onSelect: (state: string) => void;
}
- size- It helps you increase or decrease the map size according to your requirement.
- mapColour- It changes the default colour of the Map elements.
- strokeColour- It defines the colour with which the borders are represented.
- strokeWidth- It represents the width of the borders.
- hoverColour- It is the colour of the component that is hovered upon.
- onSelect- It helps you decide what to do upon clicking on a specific component in a map (say city).
Each element in a map returns a string, that represents the name of the region. That could be used to add different functionality based on the region that is clicked.
Examples
React Map components are customizable and can be easily used with whichever library you want! For example -
- react-toastify
// Import the required dependencies
import World from "@react-map/world";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
// Define the onselect function that takes in a name
 const toast = (sc) => {
    toast(sc);
  };
// Call that within the component
<World onSelect={toast} size={1600} hoverColor="orange" />
<ToastContainer />
Preview
- react-router-dom
// Import the required dependencies
import World from "@react-map/world";
import { useNavigate } from "react-router-dom";
// Define the onselect function that takes in a name
const a = useNavigate();
  const redirect = (sc) => {
  // Assuming you have defined your routes
     a(`${sc}`);
  };
// Call that within the component
<World onSelect={redirect} size={1600} hoverColor="orange" />
Disclaimer
- I did not intend to take sides in disputed territories. So, I have tried my best to include both sides of such territories so that the user is free to choose the map they are comfortable in.
- If you are facing problems in using any component, such that map is not displaying completely.. Feel free to post an issue and I would get it corrected. It most probably would be an SVG Viewport issue.
Thanks
If you read till here, thanks for taking interest in this. Hope I could be useful for you :)