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

31 lines (30 loc) 513 B
import { useState as d, useCallback as s } from "react"; function f(c) { const [e, n] = d(new Set(c)), S = s( (...o) => { const t = new Set(e); for (const w of o) t.add(w); n(t); }, [e] ), r = s( (o) => { const t = new Set(e); t.delete(o), n(t); }, [e] ), a = s(() => { n(/* @__PURE__ */ new Set()); }, []); return { set: e, add: S, remove: r, clear: a }; } export { f as useSet }; //# sourceMappingURL=useSet.js.map