score:1

Accepted answer

its because the function that you pass to usereducer is returning a function instead of a state object. try refactoring it to this:

function filestatusreducer(state, action) {
  switch (action.type) {
    case "uploading":
      return {
        ...state,
        uploading: !state.uploading,
        status: "uploading..."
      };
    case "error":
      return {
        ...state,
        status: action.message
      };

    default:
      break;
  }
}

you can read more about usereducer here.


Related Query

More Query from same tag