title: Access the state in an action in redux
body: <p>Many links and tutorials advice to group the logic in action creators in order to simplify the reducer logic.</p>
  
  <p>Imagine a simple (normalized) state:</p>
  
  <pre><code>const initialState = {
    parent: {
      allIds: [0],
      byId: {
        0: {
          parentProperty: `I'm the parent`,
          children: [1, 2]
        }
      }
    },
    children: {
      allIds: [1, 2],
      byId: {
        1: {
          childrenProperty: `I'm the children`
        },
        2: {
          childrenProperty: `I'm the children`
        }
      }
    }
  }
  </code></pre>
  
  <p>I would now delete the parent. Since only the parent refers to the children, I would also delete the children too.</p>
  
  <p>I imagine a action creator like this:</p>
  
  <pre><code>function deleteParents(parentId) {
    return {type: 'DELETE_PARENT', payload: {parentId}};
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>function deleteChild(childId) {
     return {type: 'DELETE_CHILD', payload: {childId}};
  }
  </code></pre>
  
  <p>For now, to manage this case I do something like this (with redux-thunk)</p>
  
  <pre><code>function deleteParentAndChildren(parentId) {
    return (dispatch, getState) {
      const childrenIds = myChildrenSelector(getState(), parentId);
      const deleteChildrenActions = childrenIds.map(deleteChild);
      const deleteParentAndChildrenAction = batchActions([
        deleteParents(parentId),
        ...deleteChildrenActions
      ], 'DELETE_PARENT_AND_CHILDREN');
      dispatch(deleteParentAndChildrenAction);
    }
  }
  </code></pre>
  
  <p>In that way, I compose little action into big one, and the reducer logic is very simple because it only consist to delete a key in an object.</p>
  
  <p>Conversely, I don't like to use redux-thunk (used to async actions) just to get the state (and this is considered as anti pattern). </p>
  
  <p>How do you guys manage this type of problems ?
  Does a tool like redux-sage may help ?</p>