UNPKG

@cnstra/react

Version:

React bindings for CNS neural network-inspired event flow system

20 lines (18 loc) 567 B
import { createContext, useContext } from 'react'; import { jsx } from 'react/jsx-runtime'; // src/CNSContext.tsx var CNSContext = createContext(null); function CNSProvider({ cns, children }) { const value = { cns }; return /* @__PURE__ */ jsx(CNSContext.Provider, { value, children }); } function useCNS() { const context = useContext(CNSContext); if (!context) { throw new Error("useCNS must be used within a CNSProvider"); } return context.cns; } export { CNSProvider, useCNS }; //# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map