MCPcopy Create free account
hub / github.com/TanStack/hotkeys / addShortcut

Function addShortcut

examples/preact/useHotkeys/src/index.tsx:270–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268 useHotkeys(definitions)
269
270 const addShortcut = () => {
271 const trimmed = newHotkey.trim()
272 if (!trimmed || !newLabel.trim()) return
273 setShortcuts((prev) => [
274 ...prev,
275 {
276 id: nextId++,
277 hotkey: trimmed,
278 label: newLabel.trim(),
279 description: newDescription.trim(),
280 count: 0,
281 },
282 ])
283 setNewHotkey('')
284 setNewLabel('')
285 setNewDescription('')
286 }
287
288 const removeShortcut = (id: number) => {
289 setShortcuts((prev) => prev.filter((s) => s.id !== id))

Callers 1

DynamicHotkeysDemoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…