How to Display combine APIs using FLATLIST in react Native when we have a problem to merge two different APIs?

49 views Asked by At
const App=()=>{
  const [name,setname] =useState([]);
  const [post,setpost] =useState([]);
  const fetchData=()=>{
    const APIone='https://jsonplaceholder.typicode.com/posts';
    const APItwo='https://jsonplaceholder.typicode.com/comments';
    const get_api_one=axios.get(API_one);
    const get_api_two=axios.get(API_two);
    axios.all([get_api_one,get_api_two]).then(
      axios.spread((...allData)=>{
        const alldatapost=allData[0]
        const alldatacomment=allData[1]
        console.log(alldatapost);
        console.log(alldatacomment);
      })
    )
  }
  useEffect(()=>{
    fetchData()
  },[])

I am facing datadisplay issue with following code which i want to display on screen using flatlist

0

There are 0 answers