@quirks/react
Version:
29 lines (28 loc) • 777 B
JavaScript
import { jsx as n } from "react/jsx-runtime";
import { createConfig as s } from "@quirks/store";
import { createContext as u, useRef as c, useContext as f } from "react";
import { createSelectors as m } from "./index9.js";
const e = u(
void 0
), p = (r) => {
const { children: i, config: t } = r, o = c();
if (!t)
throw new Error(
["[Quirks]: `config` must be setup within `QuirksConfig`."].join(`
`)
);
return o.current || (o.current = s(t)), /* @__PURE__ */ n(e.Provider, { value: o.current, children: i });
}, w = () => {
const r = f(e);
if (!r)
throw new Error(
["[Quirks]: `useQuirks` must be used within `QuirksConfig`."].join(`
`)
);
return m(r);
};
export {
p as QuirksConfig,
e as QuirksConfigContext,
w as useQuirks
};