@zedux/stores
Version:
The legacy composable store model of Zedux
17 lines (16 loc) • 593 B
JavaScript
import { AtomApi } from './AtomApi.js';
/**
* Create an AtomApi
*
* AtomApis are the standard mechanism for passing stores, exports, and promises
* around.
*
* An AtomApi that's returned from an atom state factory becomes _the_ api of
* the atom.
*
* - Any exports on the AtomApi are set as the atom instance's exports on
* initial evaluation and ignored forever after.
* - If promise or state references change on subsequent evaluations, it
* triggers the appropriate updates in all the atom's dynamic dependents.
*/
export const api = (value) => new AtomApi(value);