Отрисовка массива из объектов в React Expo
Есть Get запрос:
React.useEffect(() => {
const fetchData = async () => {
try {
const response = await axios.get('address');
setQuery(response.data);
console.log(query);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
Структура ответа это массив с объектами ([{id, title, desription, ...},{id, title, desription, ...}])
Результат запроса должен отображаться кодом
{query.map(query => {
return (
<>
<View>{query.title}</View>
<View>{query.description}</View>
</>
)
})
}
Но в итоге только ошибка в Vs code Property 'description' does not exist on type 'never' на строках с View.
И ошибка:
"Warning: Each child in a list should have a unique "key" prop." на web билде проекта