synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
28 lines (27 loc) • 618 B
JavaScript
import * as r from "react";
import { useMemo as a } from "react";
function l(e, t) {
return (u) => {
typeof u == "function" ? e((o) => {
const n = u(o);
return n && t(!1), n;
}) : u ? (e(!0), t(!1)) : e(!1);
};
}
function m(e, t) {
if (e && t)
throw new Error("initialValue1 and initialValue2 cannot both be true");
const [u, o] = r.useState(e), [n, s] = r.useState(t), f = a(
() => l(o, s),
[]
), c = a(
() => l(s, o),
[]
);
return [u, f, n, c];
}
export {
m as default,
m as useMutuallyExclusiveState
};
//# sourceMappingURL=useMutuallyExclusiveState.js.map