title: CastError: Cast to ObjectId failed for value "undefined" at path
body: <p>I am trying to use get data from apis, at my useEffect function, it consists of 2 get request. The 2nd get request needed a parameter which is based on the 1st get request's return value. But I encounter a error which is CastError: Cast to ObjectId failed for value &quot;undefined&quot; at path from mongoose. Anyone can help or is there any clean way to solve? Much appreciate!</p>
  <p>for example:</p>
  <pre><code> const[data,setdata]=useState([])
   useEffect(() =&gt; {
      axios.get('http:localhost.....').then({res=&gt;{
           setdata(res.data)
    }})
     axios.get(`http:localhost.....${data._id}`)
  }, [])
  </code></pre>