I am developing a project with react native.After using axios fetch data , then I changed my billingList state using returning data,but after that when I want logged this state,my array is blank.Data is returning but state doesn't change immediately.
axios.get(url, config)
.then(function (response) {
if (response.data.status === true) {
console.log(response.data.data);
setBillingList(response.data.data)
console.log(billingList);
}
})
.catch(function (error) {
console.log(error);
})
}
So using this data in responsive table,table is blank .
import { TableView } from "react-native-responsive-table"
return (
<View>
<TableView
headers={[
{
name: "S.no.",
reference_key: "no",
},
{
name: "Name",
reference_key: "name",
},
{
name: "Age",
reference_key: "age",
},
]}
rows={billingList}
/>
</View>
)