Download node_modules/@tanstack/react-store/dist/useCreateAtom.cjs.map from sitcod3/modul-s: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/sitcod3/modul-s/resolve/c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/%40tanstack/react-store/dist/useCreateAtom.cjs.map
- Command line
-
hf download hf://spaces/sitcod3/modul-s@c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/@tanstack/react-store/dist/useCreateAtom.cjs.map
-
curl -L -o useCreateAtom.cjs.map https://huggingface.co/spaces/sitcod3/modul-s/resolve/c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/%40tanstack/react-store/dist/useCreateAtom.cjs.map
1.41 kB
| {"version":3,"file":"useCreateAtom.cjs","names":[],"sources":["../src/useCreateAtom.ts"],"sourcesContent":["import { useState } from 'react'\nimport { createAtom } from '@tanstack/store'\nimport type { Atom, AtomOptions, ReadonlyAtom } from '@tanstack/store'\n\n/**\n * Creates a stable atom instance for the lifetime of the component.\n *\n * Pass an initial value to create a writable atom, or a getter function to\n * create a readonly derived atom. This hook mirrors the overloads from\n * {@link createAtom}, but ensures the atom is only created once per mount.\n *\n * @example\n * ```tsx\n * const countAtom = useCreateAtom(0)\n * ```\n */\nexport function useCreateAtom<T>(\n getValue: (prev?: NoInfer<T>) => T,\n options?: AtomOptions<T>,\n): ReadonlyAtom<T>\nexport function useCreateAtom<T>(\n initialValue: T,\n options?: AtomOptions<T>,\n): Atom<T>\nexport function useCreateAtom<T>(\n valueOrFn: T | ((prev?: T) => T),\n options?: AtomOptions<T>,\n): Atom<T> | ReadonlyAtom<T> {\n const [atom] = useState<Atom<T> | ReadonlyAtom<T>>(() => {\n if (typeof valueOrFn === 'function') {\n return createAtom(valueOrFn as (prev?: NoInfer<T>) => T, options)\n }\n\n return createAtom(valueOrFn, options)\n })\n\n return atom\n}\n"],"mappings":";;;;AAwBA,SAAgB,cACd,WACA,SAC2B;CAC3B,MAAM,CAAC,kCAAkD;AACvD,MAAI,OAAO,cAAc,WACvB,wCAAkB,WAAuC,QAAQ;AAGnE,yCAAkB,WAAW,QAAQ;GACrC;AAEF,QAAO"} |