I am having issues with calling useEffect for multiple API endpoints. Only one or the other are loaded.
My code:
const [values, setValues] = useState({
total: [],
outstanding: []
});
useEffect(() => {
DataService.dashboard_total_Amount().then((response)=>{ setValues({...values, total: response})})
ChartService.Outstanding().then((response)=>{setValues({...values, outstanding: response})})
}, [])
hope someone can point out my issue. Thanks