UNPKG

constate

Version:

Yet another React state management library that lets you work with local state and scale up to global state with ease

2 lines (1 loc) 978 B
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).constate={},e.React)}(this,(function(e,n){"use strict";function t(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)t=u[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}var r={};function o(e){return function(){return n.useContext(e)}}e.default=function(e){for(var u=arguments.length,f=new Array(u>1?u-1:0),i=1;i<u;i++)f[i-1]=arguments[i];var c=[],a=[],l=function(e){var t=n.createContext(r);c.push(t),a.push(o(t))};f.length?f.forEach((function(e){return l(e.name)})):l(e.name);var d=function(r){for(var o=r.children,u=t(r,["children"]),i=e(u),a=o,l=0;l<c.length;l+=1){var d=c[l],s=f[l]||function(e){return e};a=n.createElement(d.Provider,{value:s(i)},a)}return a};return[d].concat(a)},Object.defineProperty(e,"__esModule",{value:!0})}));