From 9e38416512fb829c36febe830675bc783bfb1a6f Mon Sep 17 00:00:00 2001 From: Segun Adebayo Date: Mon, 30 Oct 2023 20:02:35 +0000 Subject: [PATCH] revert: react use hook --- .changeset/strong-stingrays-type.md | 5 +++++ packages/frameworks/react/src/use-snapshot.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/strong-stingrays-type.md diff --git a/.changeset/strong-stingrays-type.md b/.changeset/strong-stingrays-type.md new file mode 100644 index 0000000000..41086b7267 --- /dev/null +++ b/.changeset/strong-stingrays-type.md @@ -0,0 +1,5 @@ +--- +"@zag-js/react": patch +--- + +Revert issue with react export for the `use` hook diff --git a/packages/frameworks/react/src/use-snapshot.ts b/packages/frameworks/react/src/use-snapshot.ts index f5ff3ecbf7..b6af515499 100644 --- a/packages/frameworks/react/src/use-snapshot.ts +++ b/packages/frameworks/react/src/use-snapshot.ts @@ -2,12 +2,15 @@ import { snapshot, subscribe, type Snapshot } from "@zag-js/store" import { createProxy as createProxyToCompare, isChanged } from "proxy-compare" -import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore, use } from "react" +import ReactExport, { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from "react" interface Options { sync?: boolean } +//@ts-ignore +const { use } = ReactExport + const targetCache = new WeakMap() export function useSnapshot(proxyObject: T, options?: Options): Snapshot {