As your application grows, you probably wouldn't want to write all the logic for how the state of your application needs to be transformed in a simple reducer function. What you would probably want is to write smaller reducers that specialize in managing independent parts of the state.
Take for example the following reducer function:
const initialState = { todoList: [], chatMsg: [], } const reducer = (state = initialState, action) => { switch (action.type) { case 'ADD_TODO': return { ...state, todoList: [ ...state.todoList, { title: action.title, completed: action.completed, }, ], } case 'ADD_CHAT_MSG': return { ...state, ...