I get an error when I call data in a new useEffect. I tried new useEffect but not working. What I want to do is map this data in useEffect and set it into the state. I will send this state as parameter.

```
const [data, setData] = useState();
useEffect(() => {
    const reqObj = {
      page: "1",
      size: "10",
      sort_field: "id",
    };
    getWalkthroughs(reqObj)
      .then((response) => {
        if (response?.success) {
          setData(response?.data?.writeups);
          setLoading(false);
        }
      })
      .catch((err) => {
        console.log("err", err);
      });

  }, []);

console.log(data) //working
console.log(data.length) //length error

```