I am trying to understand redux with the help of an online todo application resource.
However, I can't seem to figure out where does the 'todos' reducer get the initial state from ?
I've consoled the state but can't seem to wrap my head around it ?
After the initial render, state is consoled 3 times as,

1. [ ]
2. [ ]
3. [ state object ]

Link: '<https://codepen.io/iamrkcheers/pen/rNNoBvB>'

Any help is appreciated.

Thank You.

```
// --------- actions start  ----------

const ADD_TODO = "ADD_TODO";
const TOGGLE_TODO = "TOGGLE_TODO";
const SET_VISIBILITY_FILTER = "SET_VISIBILITY_FILTER";
const VisibilityFilters = {
  SHOW_ALL: "SHOW_ALL",
  SHOW_COMPLETED: "SHOW_COMPLETED",
  SHOW_ACTIVE: "SHOW_ACTIVE"
};

let nextTodoId = 3;

function addTodo(text) {
  return {
    type: ADD_TODO,
    id: nextTodoId++,
    text
  }
}

function toggleTodo(id) {
  return {
    type: TOGGLE_TODO,
    id
  }
}

function setVisibilityFilter(filter) {
  return {
    type: SET_VISIBILITY_FILTER,
    filter
  }
}

// --------- actions end  ----------

// --------- reducers start  ----------

function todos(state = [], action) {
  console.log('state is:',state);
  switch (action.type) {
    case ADD_TODO: {
      return [...state, {
        text: action.text,
        completed: false,
        id: action.id
      }];
    }

    case TOGGLE_TODO: {
      return state.map((todo, id) => {
        if (id === action.id) {
          return Object.assign({}, todo, {
            completed: !todo.completed
          });
        }

        return todo;
      });
    }

    default: {
      return state;
    }
  }
}

function visibilityFilter(state = VisibilityFilters.SHOW_ALL, action) {
  switch (action.type) {
    case SET_VISIBILITY_FILTER: {
      return action.filter;
    }

    default: {
      return state
    }
  }
}

const todoApp = Redux.combineReducers({
  visibilityFilter,
  todos
});

// --------- reducers end  ----------

// --------- components start  ----------

const App = () => {
  const getDate = date => new Date(date);
  const days = ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"];

  return (
    <div className="block">
      <div className="info-date">
        <div className="date">{ getDate(Date.now()).toLocaleDateString("ru") }</div>
        <div className="day">{ days[getDate(Date.now()).getDay()] }</div>
      </div>
      <AddTodo />
      <Footer />
      <VisibleTodoList />
    </div>
  );
};

const Footer = () => {
  return (
    <div className="filters">
      <FilterLink filter="SHOW_ALL">Все задачи</FilterLink>
      <FilterLink filter="SHOW_ACTIVE">Активные</FilterLink>
      <FilterLink filter="SHOW_COMPLETED">Завершенные</FilterLink>
    </div>
  );
};

const Link = ({ active, children, onClick }) => {
  if (active) {
    return <span className="filter-item non-active">{ children }</span>
  }

  return (
    <a className="filter-item" href="#" onClick = { event => {
        event.preventDefault();

        onClick();
      } }>{ children }</a>
  );
};

const Todo = ({ onClick, completed, text }) => {
  const styles = {
    textDecoration: completed ? "line-through" : "none"
  };

  return (
    <li onClick = { onClick } style = { styles }>
      <a>{ text }</a>
    </li>
  );
};

const TodoList = ({ todos, onTodoClick }) => {
  return (
    <div className="list">
      <ul>
        {
          todos.map(todo => <Todo
            key = { todo.id } { ...todo }
            onClick = { () => onTodoClick(todo.id) } />)
        }
      </ul>
    </div>
  );
};

// --------- components end  ----------

// --------- containers start  ----------

let AddTodo = ({ dispatch }) => {
  let input;

  return (
    <div>
      <form className="addForm" onSubmit = { event => {
          event.preventDefault();

          if (!input.value.trim()) {
            return;
          }

          dispatch(addTodo(input.value));

          input.value = "";
        } }>
        <input type="text" placeholder="Что нужно сделать?" ref = { node => input = node }/>
        <button type="submit" className="btn"></button>
      </form>
    </div>
  );
};

AddTodo = ReactRedux.connect()(AddTodo);

var mapStateToProps = (state, ownProps) => {
  return {
    active: ownProps.filter === state.visibilityFilter
  };
};

var mapDispatchToProps = (dispatch, ownProps) => {
  return {
    onClick: () => {
      dispatch(setVisibilityFilter(ownProps.filter));
    }
  };
};

const FilterLink = ReactRedux.connect(
  mapStateToProps,
  mapDispatchToProps
)(Link);

const getVisibleTodos = (todos, filter) => {
  switch (filter) {
    case "SHOW_ALL": {
      return todos;
    }

    case "SHOW_COMPLETED": {
      return todos.filter(todo => todo.completed);
    }

    case "SHOW_ACTIVE": {
      return todos.filter(todo => !todo.completed);
    }

    default: {
      return todos;
    }
  }
};

var mapStateToProps = state => {
  return {
    todos: getVisibleTodos(state.todos, state.visibilityFilter)
  }
};

var mapDispatchToProps = dispatch => {
  return {
    onTodoClick: id => {
      dispatch(toggleTodo(id));
    }
  };
};

const VisibleTodoList = ReactRedux.connect(
  mapStateToProps,
  mapDispatchToProps
)(TodoList);

// --------- containers end  ----------

// --------- application start  ----------

const initialState = {
  visibilityFilter: "SHOW_ALL",
  todos: [
    {
      id: 0,
      text: "Изучить React",
      completed: true
    },
    {
      id: 1,
      text: "Изучить Redux",
      completed: true
    },
    {
      id: 2,
      text: "Написать приложение \"Список задач\"",
      completed: false
    }
  ]
};

let store = Redux.createStore(todoApp, initialState);

ReactDOM.render(
  <ReactRedux.Provider store = { store }>
    <App />
  </ReactRedux.Provider>,
  document.querySelector("#root")
);

// --------- application end  ----------

```