Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
100
function
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
onToggle
Function · 0.70
Calls
3
delete
Method · 0.80
has
Method · 0.65
add
Method · 0.65
Tested by
no test coverage detected