Aym*_*men 3 javascript ecmascript-6 reactjs react-native
因此,在获取数据并尝试将其分配给我的 const 后,我收到此错误。我第一次使用钩子,我不知道我做错了什么。这是我的代码:
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();
});
Run Code Online (Sandbox Code Playgroud)
这就是 console.log 显示的内容:
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",
},
]}
]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8222 次 |
最近记录: |