title: Is there some way where I can get the data from a useSelector and store it as an initial value of a useState?
body: <p>Let's say I have this useSelector:</p>
  <pre><code>const mapState = ({ data }) =&gt; ({
    Items: data.items,
  });
  </code></pre>
  <p>And the items is an array. This is in JSON object:</p>
  <pre><code>[
    {
      itemName: &quot;Item1&quot;,
      itemPrice: &quot;5&quot;,
    },
    {
      itemName: &quot;Item2&quot;,
      itemPrice: &quot;5&quot;,
    },
  ];
  </code></pre>
  <p>These are the codes:</p>
  <pre><code> const Item = () =&gt; {
        const { items } = useSelector(mapState);
        const dispatch = useDispatch();  
    
  
    useEffect(() =&gt; {
      dispatch(getData(Items));
    }, []);
      
    //store a data item.name inside the useState
    const [itemName, setItemName] = useState(&quot;&quot;);
  
    return (
      &lt;Container&gt;
      &lt;/Container&gt;
    );
  };
  
  export default Item;
  </code></pre>
  <p>Is it possible to set the initial value of the itemName from a data of useSelector? Like something like this?</p>
  <pre><code>const [itemName, setItemName] = useState(itemName);
  </code></pre>