title: How to handle parent child data relationships in redux
body: <p>I'm building a simple todo app where a user can create projects and then add todo items. I believe my state should look something like this:</p>
  
  <pre><code>{
    projects: {
      1: {
        id: 1,
        title: "New Project",
        todos: [1, 2]
      }
    },
    todos: {
      1: {
        id: 1,
        text: "This is the first todo",
        isComplete: true,
        project: 1
      },
      2: {
        id: 2,
        text: "This is the second todo",
        isComplete: false,
        project: 1
      }
    }
  }
  </code></pre>
  
  <p>When creating a new todo I need to update the <code>todos</code> state with the new todo and I need to update the parent project in the <code>projects</code> state.</p>
  
  <p>What is the best way to handle this? Do both of the reducers need actions to handle this? Or is there someway the <code>todos</code> reducer can call an update action in the <code>projects</code> reducer? </p>
  
  <p><strong>EDIT: Here's how I changed the data structure to work better with redux</strong></p>
  
  <pre><code>{
    projects: {
      condition: {
        currentProject: 1
      },
      entities: {
        1: {
          id: 1,
          title: "New Project"
        }
      }
    },
    todos: {
      condition: {
        currentFilter: 'SHOW_ALL'
      },
      entities: {
        1: {
          id: 1,
          text: "This is the first todo",
          isComplete: true,
          project: 1
        },
        2: {
          id: 2,
          text: "This is the second todo",
          isComplete: false,
          project: 1
        }
      }
    }
  }
  </code></pre>
  
  <p>This way each of my reducers being combined at the root level are scoped to one root key. <code>entities</code> are persisted but <code>condition</code> is not. All other parts of state are computed use <code>reselect</code>. I'd be curious to see how others are solving similar problems in a front end only app.</p>