title: Cannot access the property of an object - getting undefined
body: <p>Now i have seen the other questions of this type and tried the solutions and it didnt work.</p>
  <p>So now whats the problem?</p>
  <p>Im using redux dispatching same data, an object with a label and userID, im then putting that data in a const pharmas with useSelector, when i log the const i get an object in the console containing the dispatched data and that is fine.</p>
  <p>Now the problem is when i try to log pharmas.userID i get undefined for some reason.</p>
  <p>Heres how it looks like when i log it normally <a href="https://i.stack.imgur.com/bcyei.png" rel="nofollow noreferrer">console.log(pharmas)</a> and this is<a href="https://i.stack.imgur.com/n4FLq.png" rel="nofollow noreferrer">JSON.stringify(pharmas)</a></p>
  <p>Can someone please explain why am i getting <a href="https://i.stack.imgur.com/GTe6l.png" rel="nofollow noreferrer">cannot read property of undefined</a></p>
  <p>and what can i do to extract userID since i need it to filter out some data?</p>
  <p>Thanks in advance!</p>
  <p>Heres the code, getting data and and logging it</p>
  <pre class="lang-js prettyprint-override"><code>const pharmas = useSelector ((state) =&gt; state.pharmacies.filteredPharmacies)
  
  console.log('pharmas', pharmas)
  
  </code></pre>
  <p>Dispatching the data:</p>
  <pre class="lang-js prettyprint-override"><code>const handleOnChange = (value) =&gt; {
   dispatch(getPharmacie(value))
   
   console.log('HERE',value)
  };
  </code></pre>
  <p>Heres what the &quot;value&quot; looks like in the console <a href="https://i.stack.imgur.com/FtKVx.png" rel="nofollow noreferrer">Exactly like i get it in pharmas</a>:</p>
  <p>heres the reducer:</p>
  <pre><code>
  export function pharmacies(
    state = { pharmacies: [], selectedPharmacies: [], filterPharmacies: [] },
    action
  ) {
    switch (action.type) {
      case SET_PHARMACIES_DATA:
        return {
          ...state,
          pharmacies: action.payload,
      };
      case SET_PHARMACIE:
        return{
          ...state,
          filterPharmacies: action.payload,
      }
      case GET_PHARMACIE:
       return{
        ...state,
        filteredPharmacies: action.payload,
       }
      case SET_PHARMACIES:
  </code></pre>
  <p>Using GET_PHARMACIE case:</p>
  <p>But when i console.log(pharmas.userID) i get the error undefined.</p>
  <p>Heres the GET_PHARMACIE in store from redux extension <a href="https://i.stack.imgur.com/trzYh.png" rel="nofollow noreferrer">state</a></p>