title: How could I pass JSON object array result to my api URL? (In REACT)
body: <p>I have to fetch 2 api from backend, and try to get the result from this two. but, at the moment, the JSON result I get from the first API is object Array in JSON. I need to pass the id from first API(using setState) to second API for path variables. But when I do in my way, it fail to retrieve the data. Consider the code below:</p>
  <pre><code>      componentDidMount(){
          // console.log(loginEmail)
            fetch(`http://localhost:9000/api/item/list`,)
            .then((resp)=&gt;{
              resp.json().then((res)=&gt;{
               console.log(res.data);
               // localStorage.setItem('id', res.data.user_info.id);
                this.setState({data: res.data});
              
              }
                
              )
            })
  
            const id = this.state.data.id;
  
            fetch(`http://localhost:9000/api/item/photo/view/${id}`,)
            .then((resp)=&gt;{
              resp.json().then((res)=&gt;{
               console.log(res);
               // localStorage.setItem('id', res.data.user_info.id);
                this.setState({res});}
              )
            })
          
          
          }
  </code></pre>