So I get this error after I fetched data and tried to assign it to my const. I'm using hooks for the first time and I don't know what I did wrong. here is my code:
export default function MedProfilScreen({route}){
//const {id,name,specialite,work}=route.params;
const [data,setData]=useState([])
useEffect(()=>{
fetch('http:......)
.then((response) => response.json())
.then((res) => {
setData(data.res);
console.log(res)
})
.done();
});
And this is what the console.log shows:
Array [
Object {
"code": "12459552",
"id": 7,
"name": "Dr xavier vilan",
"speciality": "Cardio",
},
Object {
"education": Array [
Object {
"date_debut": "2020-02-07",
"date_end": "2020-02-06",
"diplome": "asmaa",
"school": "asmaa",
"city": "vullez",
},
]}
]