title: Redux how to use createEntityAdapter on a nested property?
body: <p>I am creating an app with React/Redux and I am new to using both React and Redux. I'm stuck trying to figure out how to structure the redux store. Here is a brief description of what I am trying to achieve, generalized using the book example as in the redux createEntityAdapter docs</p>
  <p>I have a page with a list of books. The user can click one or many books and for each book a list is displayed of the chapters. New or missing chapters can be added anytime as they become available on the server. The added chapters need to be added to the list in the correct position.</p>
  <ul>
  <li>Book 1
  <ul>
  <li>Chapter 1</li>
  <li>Chapter 2</li>
  <li>Chapter 3</li>
  <li>Chapter 6</li>
  </ul>
  </li>
  <li>Book 2</li>
  <li>Book 3</li>
  </ul>
  <p>The book list is a component, and the chapters list is another component, but since there are many books, there will be many instances of the chapter list component. Each component has its own slice.</p>
  <p>The store looks like:</p>
  <pre><code>bookList : [ Book1, Book2, Book3, ...]
  ChapterList: { 
    Book1 : {
      chapters: [
        { 
           Chapter : 'Chapter1',
           info: 'Chapter info',
           other: 'more stuff'
        },
        { 
           Chapter : 'Chapter2',
           info: 'Chapter info',
           other: 'more stuff'
        },
        {...}
      ],
      bookInfo: 'info about book'
    },
    Book2 : { ... },
    Book3 : { ... }
  }
  
  </code></pre>
  <p>The problem is that chapter info is being streamed and thus is updated continuously and missing chapters can arrive at any time. As a result I would need to sort the chapters array each time new data arrives, whereas the array is not very long, in the order of 50 elements, new data arrives a few times per second.</p>
  <p>I intended to use createEntityAdapter to normalize the chapters array, but I don't see how this is possible given that it is nested in the Book# property and the Book# property is needed because I'm using multiple instances of the ChapterList component.</p>
  <pre><code>const ChapterListAdapter = createEntityAdapter({
    // where bookNum needs to Book1, Book2, Book3 etc... 
    selectId: (chapterList) =&gt; chapterList[bookNum].chapters,
  
    sortComparer: (a, b) =&gt; a.chapters.localeCompare(b.chapters
  }) 
  </code></pre>
  <p>How do I solve this? Modify the store? Is there a way to flatten chapterList such that chapters is at the top level? Do I write my own normalizing/sorting logic into the the reducer?</p>