There is two stages for getting data in custom widget. In first stage you will get ("status":"loading") in this case you will not receive data. In second stage you will get ("status":"available") in this case you will get your data .
You need to call a useEffect hool in your react code and pass the dependencies in dependency array.
useEffect(()=>{
try{
// Get you data here
}catch(err){
console.log(err)
}
},[<datasourceKey>.status]);
Make sure you replace <datasourcekey> to your key.
Please accept the answer if it helps you.