title: How to render state from Redux with map function
body: <p>Hello I have basic code with useSelector, where data from the useEffect is stored into <code>currentItems</code>.</p>
  <p>How to iterate through the state array and render it?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { useEffect } from "react";
  import { useSelector, useDispatch } from "react-redux";
  import { getToDoItems, setItems } from "../redux/globalSlice";
  
  const ToDoList = () =&gt; {
    const dispatch = useDispatch();
    const { currentItems } = useSelector((state) =&gt; state.global);
  
    useEffect(() =&gt; {
      async function getToDoItems(id) {
        const response = await fetch(
          `https://xxx.mockapi.io/api/list/${id}/todos`
        );
        const data = await response.json();
        dispatch(setItems(data));
      }
      getToDoItems(2);
    }, []);
  
    return (
      &lt;div&gt;
        &lt;h1&gt;ahoj&lt;/h1&gt;
        {currentItems.map((todo) =&gt; {
          &lt;div&gt;{todo.title}&lt;/div&gt;;
        })}
      &lt;/div&gt;
    );
  };
  
  export default ToDoList;</code></pre>
  </div>
  </div>
  </p>
  <p>I understand that this is an asynchronous operation, but I don't know how to render it until after loading and storing data to store from the api.</p>