UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

28 lines (27 loc) 618 B
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