score:1

Accepted answer

Delete your filesUploaded reducer. You don't need it. Instead, just use the files reducer:

const rootReducer = combineReducers({
    files,
}); 

Please note, the slice of state you are interested in will be called files. Change your mapStateToProps function to this:

const mapStateToProps = state => {
    const {isFetching, items: files} = state.files

    console.log(files);

    return {
        files,
        isFetching,
    }
};

You can see here, we grab the files slice of state and pass that into your component.

score:1

Your filesUploaded reducer does not make any sense. I'm not sure what filesUploaded is even supposed to be doing. Your files reducer looks like a normal reducer. It seems like you could just delete filesUploaded and everything would be fine.

In particular, filesUploaded is calling files(state[action], action). action is an object. What is state[SOME_OBJECT] supposed to be? Because it's being parsed as state['[object Object]'] which is surely undefined and never would become defined.

Your files reducer also has an items parameter that is just never used. A reducer should only have two parameters: state and action. Drop the items parameter.

Your mapStateToProps is looking for state.uploadedFiles, but your reducer is called filesUploaded. It should be state.filesUploaded (or if you replace it with the files reducer, just state.files).

mapStateToProps will not need || {isFetching: true, items: []} since you have an initial state on your files reducer.


Related Query

More Query from same tag