MCPcopy Create free account
hub / github.com/adobe/react-spectrum / toggleKey

Function toggleKey

packages/react-stately/src/tree/useTreeState.ts:100–109  ·  view source on GitHub ↗
(set: Set<Key>, key: Key)

Source from the content-addressed store, hash-verified

98}
99
100function toggleKey(set: Set<Key>, key: Key): Set<Key> {
101 let res = new Set(set);
102 if (res.has(key)) {
103 res.delete(key);
104 } else {
105 res.add(key);
106 }
107
108 return res;
109}

Callers 1

onToggleFunction · 0.70

Calls 3

deleteMethod · 0.80
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected