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

@zhilibyli/react-compiler-yandex-maps

v2.0.0

Published

React Compiler yamps3 wrapper. Get ymaps3 components via import.

Readme

@zhilibyli/react-compiler-yandex-maps

NPM Version npm bundle size

Библиотека для получения компонентов ymaps3 через import

React-обёртка над ymaps3: альтернативный способ получения компонентов Яндекс.Карт. Используйте import вместо создания скрипта и получения компонентов через асинхронный window.ymaps3.import.

Библиотека написана на TypeScript с использованием @yandex/ymaps3-types.

Установка

npm i @zhilibyli/react-compiler-yandex-maps

или

yarn add @zhilibyli/react-compiler-yandex-maps

Использование с TypeScript

npm i -D @yandex/ymaps3-types@latest

Примеры

Зачем это нужно

  • ваши компоненты остаются простыми
  • проще, чем подход из официальной документации
  • не нужно писать логику загрузки компонентов и модулей для них
  • не нужно создавать скрипт или настраивать externals в webpack

✅ Ваш код с этой библиотекой

import React from "react";
import {
  YMap,
  YMapDefaultSchemeLayer,
  YMapDefaultFeaturesLayer
  // ...другие компоненты
} from "@zhilibyli/react-compiler-yandex-maps";
import { features, LOCATION } from './helpers'

function Map() {
  return (
    <YMapComponentsProvider apiKey={process.env.REACT_APP_YMAP_KEY}>
      <YMap location={location}>
        <YMapDefaultSchemeLayer />
        <YMapDefaultFeaturesLayer />
        <YMapDefaultMarker
          coordinates={LOCATION.coordinates}
        />
      </YMap>
    </YMapComponentsProvider>
  );
}

export default Map;

❌ Ваш код без этой библиотеки

import React, {useEffect, useMemo} from "react";
import {features, LOCATION} from './helpers'

function Map() {
  const [data, setData] = useState(); 
  const {
    YMap,
    // ...другие компоненты
  } = useMemo(() => {
    if (data?.reactify) {
      return reactify.module(data.ymap);
    }
  }, [data]);

  useEffect(() => {
    const script = document.createElement('script');
    document.body.appendChild(script);
    script.type = "text/javascript";
    script.src = `https://api-maps.yandex.ru/v3/?apikey=${key}&lang=${lang}`;
    script.onload = async () => {
      const ymaps = window.ymaps3
      await ymaps.ready;
      const ymaps3Reactify = await ymaps.import('@yandex/ymaps3-reactify');
      const reactify = ymaps3Reactify.reactify.bindTo(React, ReactDOM);

      setData({
        reactify,
        ymaps
      });
      /*
      и другая логика, не связанная с рендерингом,
      для загрузки модулей ymap, например YMapDefaultMarker
      */
    }
  }, [])
  
  if (!YMap) {
    return null;
  }

  return (
    <YMap location={location}>
      <YMapDefaultSchemeLayer/>
      <YMapDefaultFeaturesLayer/>
      <YMapDefaultMarker
        coordinates={LOCATION.coordinates}
      />
    </YMap>
  );
}

export default Map;

С чего начать

  1. Получите API-ключ для JS API карт
  2. Укажите домен, на котором будет размещена карта
  3. Для разработки измените ваш /etc/hosts, чтобы проксировать домен на localhost (карта будет работать на http://{domain}:{port})
  4. Установите и используйте библиотеку

Примеры на codesandbox смотрите выше. Более подробную информацию можно найти в официальной документации.

API

API компонента YMapComponentsProvider

YMapComponentsProvider — корневой компонент, который должен содержать остальные компоненты библиотеки в качестве дочерних узлов.

interface YMapComponentsProviderProps {
  apiKey: string
  lang?: string
  onLoad?: (params: {
    reactify: Reactify;
    ymaps: typeof import("@yandex/ymaps3-types/index");
  }) => any
  onError: (e?: unknown) => void
  children: ReactNode | ReactNode []
  reuseLoadPromise?: boolean;
}
type getYmaps3ReadyObject = () => Promise<YMapsV3>;

Остальные компоненты имеют такой же API, как в официальной документации

Библиотека предоставляет следующие компоненты:

  • YMapComponentsProvider
  • YMap
  • YMapDefaultMarker
  • YMapHintContext
  • YMapHint
  • YMapClusterer
  • YMapZoomControl
  • YMapGeolocationControl
  • ThemeContext
  • YMapDefaultSchemeLayer
  • YMapDefaultFeaturesLayer
  • YMapLayer
  • YMapControl
  • YMapControls
  • YMapControlButton
  • YMapTileDataSource
  • YMapMarker
  • YMapListener
  • YMapFeature
  • YMapDefaultSatelliteLayer
  • YMapCollection
  • YMapContainer
  • YMapFeatureDataSource
  • YMapCustomClusterer