I'm going through many Redux-tutorials, and something that confuses me, is the fact, that when creating a Redux store with a combined reducer, there often is the reference to a name rootReducer
as the root reducer, although it has never been actively named.
Is this something like a default behaviour that is taken advantage of? Because it seems to be working like that.
I suspect, it has something to do with the way, the reducers are combined and exported with
export default combineReducers
.
Here is an example:
./reducers/combined.js :
import { combineReducers } from 'redux';
import filmReducer from './filmReducer';
export default combineReducers({
media: filmReducer
});
then, in ./store.js :
import { createStore, applyMiddleware } from 'redux';
...
import rootReducer from './reducers'; // why can 'rootReducer' be imported?
Anyway, after a long search, I still couldn't find any reference to this phenomena.