MCPcopy Create free account
hub / github.com/downshift-js/downshift / stateReducer

Function stateReducer

test/useMultipleSelect.test.tsx:50–63  ·  view source on GitHub ↗
(_state, actionAndChanges)

Source from the content-addressed store, hash-verified

48 items,
49 selectedItem: null,
50 stateReducer(_state, actionAndChanges) {
51 const {changes, type} = actionAndChanges
52 switch (type) {
53 case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:
54 case useSelect.stateChangeTypes.ToggleButtonKeyDownSpaceButton:
55 case useSelect.stateChangeTypes.ItemClick:
56 return {
57 ...changes,
58 isOpen: true, // keep the menu open after selection.
59 }
60 default:
61 return changes
62 }
63 },
64 onStateChange({type, selectedItem: newSelectedItem}) {
65 switch (type) {
66 case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…