MCPcopy Create free account
hub / github.com/react-dropzone/react-dropzone / reducer

Function reducer

src/index.js:1050–1099  ·  view source on GitHub ↗

* @param {DropzoneState} state * @param {{type: string} & DropzoneState} action * @returns {DropzoneState}

(state, action)

Source from the content-addressed store, hash-verified

1048 * @returns {DropzoneState}
1049 */
1050function reducer(state, action) {
1051 /* istanbul ignore next */
1052 switch (action.type) {
1053 case "focus":
1054 return {
1055 ...state,
1056 isFocused: true,
1057 };
1058 case "blur":
1059 return {
1060 ...state,
1061 isFocused: false,
1062 };
1063 case "openDialog":
1064 return {
1065 ...initialState,
1066 isFileDialogActive: true,
1067 };
1068 case "closeDialog":
1069 return {
1070 ...state,
1071 isFileDialogActive: false,
1072 };
1073 case "setDraggedFiles":
1074 return {
1075 ...state,
1076 isDragActive: action.isDragActive,
1077 isDragAccept: action.isDragAccept,
1078 isDragReject: action.isDragReject,
1079 };
1080 case "setFiles":
1081 return {
1082 ...state,
1083 acceptedFiles: action.acceptedFiles,
1084 fileRejections: action.fileRejections,
1085 isDragReject: false,
1086 };
1087 case "setDragGlobal":
1088 return {
1089 ...state,
1090 isDragGlobal: action.isDragGlobal,
1091 };
1092 case "reset":
1093 return {
1094 ...initialState,
1095 };
1096 default:
1097 return state;
1098 }
1099}
1100
1101function noop() {}
1102

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…