title: Redux-Toolkit: how to deal with an entity with compound keys?
body: <p>I'm trying to use Redux-Toolkit's <a href="https://redux-toolkit.js.org/api/createEntityAdapter" rel="nofollow noreferrer">createEntityAdapter</a> in an entity that has compound keys. For example, my territories entity has a type (municipality, state, biome, etc) and a geocode number. The pair {type, geocode} is the compound key of this entity.</p>
  
  <p>I want to be able to use <strong>selectById</strong> and other selectors. My first thought was to create an <strong>id</strong> field that concatenates type, ";" and geocode, but I'm sure there's a better way.</p>
  
  <pre><code>import { createEntityAdapter } from '@reduxjs/toolkit'
  
  const adapter = createEntityAdapter({
      // selectId: (item) =&gt; ???,
  })
  
  const APIresponse = {
      data: [
          { type: 'state', geocode: 1, value: 123},
          { type: 'state', geocode: 2, value: 66},
          { type: 'municipality', geocode: 1, value: 77},
          { type: 'municipality', geocode: 2, value: 88},
          { type: 'municipality', geocode: 3, value: 99}
      ]
  }
  </code></pre>