title: Can I Set Initial State with Props in React + Redux?
body: <p>I'm having an issue where a state I have is showing as undefined and I suspect it might be because I'm passing the intial state as props. </p>
  
  <p>Here's what the useState statement looks like:</p>
  
  <pre><code>const [filteredData, setData] = useState(props.cardsToShow);
  </code></pre>
  
  <p>I have cardsToShow as a state defined within MapStateToProps like this</p>
  
  <pre><code>cardsToShow: searchCards(state)
  </code></pre>
  
  <p>and it is populating based on the following search statement i have. note that baseball is the initial data load and search is a search query in store.</p>
  
  <pre><code>const searchCards = ({ baseball, search }) =&gt; {
    return search
      ? baseball.filter(a =&gt;
          a.title[0].toLowerCase().includes(search.toLowerCase())
        )
      : baseball;
  };
  </code></pre>
  
  <p>If i console log <code>props.cardsToShow</code> i get data which is an object of arrays.</p>
  
  <p>If i console log <code>filteredData</code> i get an empty object.</p>
  
  <p>Any ideas?</p>