UNPKG

jotai

Version:

👻 Next gen state management that will spook you

2 lines (1 loc) • 541 B
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jotai")):"function"==typeof define&&define.amd?define(["exports","jotai"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jotaiZustand={},t.jotai)}(this,(function(t,e){"use strict";t.atomWithStore=function(t){var n=e.atom(t.getState());return n.onMount=function(e){var n=function(){e(t.getState())},o=t.subscribe(n);return n(),o},e.atom((function(t){return t(n)}),(function(e,o,i){var f="function"==typeof i?i(e(n)):i;t.setState(f,!0)}))}}));