A component, a hook, and a HOC that all share one registry: whichever call site claims an id first wins, every other one renders nothing. Handy for a modal root, a toast host, or anything else that should exist exactly once even if it gets mounted from two places by mistake.
The idea came out of a small coding exercise where "make sure there's only one modal, even if something renders it twice" turned out to be a genuinely fiddly problem once React.StrictMode enters the picture - StrictMode double-invokes a function component's render body in development, and there's no purity-safe way, from inside render, to tell "my own StrictMode replay" apart from "a different caller". Pulling that logic out into its own package, writing real tests against it, and fixing it properly surfaced two genuine bugs along the way: the original had no per-instance memory (so a component re-rendering more than twice would silently stop rendering, forever), and a "detect StrictMode" check that looked reasonable but statically evaluated to the same value in every environment - dead code wearing a live wire's clothes.
npm i react-single-instanceLive playground