Trying to go through redux react tutorial and I am wondering where rootReducer come from
import { createStore } from "redux";
import rootReducer from "./reducers";
export default createStore(rootReducer);
Does combineReducers auto export rootReducer?
https://codesandbox.io/s/9on71rvnyo?file=/src/redux/store.js
Second question in
/components/AddTodo.js
handleAddTodo = () => {
this.props.addTodo(this.state.input);
this.setState({ input: "" });
};
handleAddTodo calls the addTodo action
/redux/actions.js
export const addTodo = content => ({
type: ADD_TODO,
payload: {
id: ++nextTodoId,
content
}
});
Which just returns an object
But what connects the addTodo to the reducer itself in /reducers/todos.js?
export default function(state = initialState, action) {
switch (action.type) {
case ADD_TODO: {
.....