@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
22 lines (21 loc) • 462 B
JavaScript
import { createContext as u, useContext as a } from "react";
function c(e) {
return () => {
const t = a(e);
if (!t) throw new Error(`The context ${e.displayName} was not found!`);
return t;
};
}
function i(e) {
return e.Provider;
}
function s(e, t = null) {
const o = u(t);
o.displayName = e;
const n = c(o), r = i(o);
return [n, r, o];
}
export {
s as createNonNullableContext
};
//# sourceMappingURL=createNonNullableContext.js.map