react-call@2.0.0-next.6
Pre-releaseMinor Changes
-
2e72674: New
react-call/hostsubpath export — an imperativemount(element, options?)helper for environments that render multiple isolated React subtrees in parallel for previewing (Storybook autodocs page, Ladle, Histoire, react-cosmos). Mounts a single shared Root in a body-level<div data-react-call-host>via its owncreateRoot, sidestepping the multi-root call-time throw that decorator-per-story patterns otherwise hit.// .storybook/preview.tsx import { mount } from "react-call/host"; import { Confirm } from "../src/Confirm"; mount(<Confirm />);
Options:
wrapper?: ComponentType<{ children: ReactNode }>— wraps the rendered element in providers (theme, i18n, router). The wrapper runs inside the Confirm's own React tree, so context from story decorators does not propagate; for reactive providers tied to host state (e.g. Storybook globals), subscribe inside the wrapper viauseGlobalsfrom@storybook/preview-apior an external store.container?: HTMLElement— mount target; defaults to a fresh<div data-react-call-host>appended todocument.body.
Idempotent under HMR: subsequent
mount()calls re-render against the cached root (kept onglobalThis[Symbol.for('react-call.host')]) rather than creating a second one, so an openConfirm.call()survives edits topreview.tsx.Adds
react-domas an optional peer dependency (mirrors theviteoptional peer). Consumers who don't importreact-call/hostsee no install change.See ADR-0016 for the design discussion.