@mongez/react-atom
Version:
A simple state management tool for React Js.
19 lines (18 loc) • 1.02 kB
text/typescript
import { ReactAtom } from "./types.mjs";
import { Atom, AtomActions, AtomCollectionActions, AtomOptions, AtomValue, CollectionOptions } from "@mongez/atom";
//#region ../@mongez/react-atom/src/react-atom.d.ts
/**
* Create a new React-aware atom.
*
* The returned atom carries hooks (`useState`, `useValue`, `use`, `useWatch`)
* and a `<Provider>` component as instance methods. All hooks honor the
* nearest `<AtomStoreProvider>` and use `useSyncExternalStore` underneath.
*/
declare function atom<Value = any, Actions extends AtomActions<Value> = AtomActions<Value>>(data: AtomOptions<AtomValue<Value>>): ReactAtom<Value, Actions>;
/**
* Create a React-aware collection atom for working with arrays.
*/
declare function atomCollection$1<Value = any, Actions extends AtomCollectionActions<Value> = AtomCollectionActions<Value>>(options: CollectionOptions<Value>): Atom<Value[], AtomCollectionActions<Value>>;
//#endregion
export { atom, atomCollection$1 as atomCollection };
//# sourceMappingURL=react-atom.d.mts.map