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

@cp949/kakao-postcode-react

v1.0.0

Published

Browser-only React 18/19 wrapper for Kakao Postcode embed() with component, hook, script loader, and raw + normalized results

Downloads

18

Readme

@cp949/kakao-postcode-react

한국어

React wrapper for Kakao Postcode embed() with a minimal component, a lower-level hook, a script loader, and a result normalizer.

Install

pnpm add @cp949/kakao-postcode-react

Use Node 20+ for development, CI, and package installation. This does not change the browser runtime requirement: the package still runs in the browser and loads Kakao's postcode script client-side.

Peer dependencies:

  • react
  • react-dom

Compatibility coverage:

  • Tested with React 18.3.x
  • Tested with React 19.x

Current Package Surface

  • KakaoPostcodeEmbed
  • useKakaoPostcodeEmbed
  • loadKakaoPostcodeScript
  • normalizeKakaoPostcodeResult

This first usable version is intentionally focused on embed(). Popup APIs such as open() are out of scope for now.

Basic Component Usage

import { KakaoPostcodeEmbed } from "@cp949/kakao-postcode-react";

export function AddressSearch() {
  return (
    <KakaoPostcodeEmbed
      height={420}
      q="판교역"
      onComplete={({ raw, normalized }) => {
        console.log(raw.zonecode);
        console.log(normalized.fullRoadAddress);
      }}
    />
  );
}

Basic Hook Usage

import { useKakaoPostcodeEmbed } from "@cp949/kakao-postcode-react";

export function AddressSearchPanel() {
  const { containerRef, status, error, close, reload } = useKakaoPostcodeEmbed({
    q: "판교역",
    autoClose: false,
    onComplete: ({ normalized }) => {
      console.log(normalized);
    },
  });

  return (
    <section>
      {status === "loading-script" ? <p>Loading...</p> : null}
      {status === "error" ? <p>{error?.message}</p> : null}
      <div ref={containerRef} style={{ height: 420 }} />
      <button type="button" onClick={reload}>
        Reload
      </button>
      <button type="button" onClick={close}>
        Close
      </button>
    </section>
  );
}

Embed Option Notes

  • q sets Kakao's initial search query for embed().
  • autoClose is supported for iframe mode and is passed to Kakao's embed() options.
  • In this package, autoClose is not forwarded through the Kakao constructor options.

Result Shape

onComplete returns both the official Kakao payload and a normalized helper model:

type KakaoPostcodeCompleteEvent = {
  raw: KakaoPostcodeRawResult;
  normalized: KakaoPostcodeNormalizedResult;
};

normalized includes fields such as:

  • extraAddress
  • fullRoadAddress
  • fullJibunAddress
  • isRoadAddress
  • isJibunAddress

SSR And Runtime Notes

  • This package is browser-only. Load and render it on the client.
  • The library depends on Kakao's hosted postcode script and does not bundle it.
  • The script URL currently targets Kakao's official CDN: https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js
  • Kakao's API is a browser global API, so the hook/component should not run during server render.
  • If a matching Kakao script tag is already marked as failed, the loader removes that tag and retries with a fresh script element on the next load attempt.
  • The published package is aimed at ESM/CJS bundler consumers. If you use the UMD build directly in a browser, provide the React global first.

Operational Guidance

  • Option changes that affect the Kakao embed, such as height, width, and theme, trigger a re-embed so the live iframe reflects the latest settings.
  • Callback-only updates do not trigger a re-embed. Updating onComplete, onResize, or onClose keeps the current embed instance mounted.
  • In React Strict Mode, development-only effect replays can cause extra mount and cleanup cycles. The hook is intended to tolerate that behavior during development.
  • The loader retry path is automatic for a previously failed Kakao script tag, so the next load attempt can recover without manual DOM cleanup.
  • Because the package depends on Kakao's hosted script URL, your CSP policy may need to allow https://t1.kakaocdn.net in script-src.

Design Notes

  • Official Kakao facts and package design choices are intentionally separated in this repo's docs.
  • The default component keeps UI minimal so consumers can override styling freely.
  • If you need stricter control over lifecycle or layout, use useKakaoPostcodeEmbed directly.

Development Verification

  • pnpm --filter @cp949/kakao-postcode-react test
  • pnpm --filter @cp949/kakao-postcode-react build
  • pnpm --filter @cp949/kakao-postcode-react test:artifacts
  • pnpm test:browser
  • pnpm smoke:react18
  • pnpm smoke:react19

The default package test command is source-only and does not require a prebuilt dist/ directory. Run test:artifacts after build when you want to verify emitted package files.

The React 18 and React 19 smoke commands install the packed tarball into a temporary consumer and run a lightweight jsdom render check for both the component and hook APIs, including custom fallback rendering and hook q/autoClose embed options.

Publishing

Use npm authentication first, then verify the package before a real publish.

npm whoami
pnpm --filter @cp949/kakao-postcode-react build
pnpm --filter @cp949/kakao-postcode-react pack

If the packed output looks correct, publish from the repo root:

pnpm release

You can also publish only this package directly:

pnpm --filter @cp949/kakao-postcode-react run release

If 1.0.0 is already published, bump packages/kakao-postcode-react/package.json to a new version before publishing again.