My code below, i am getting the error in the heading of this post. it must be something simple can you guys advise?
import {useEffect, useState} from 'react'
import axios from 'axios'
import XMLParser from 'react-xml-parser'
import AuthorList from '../components/AuthorList'
function Home() {
const [authors, setAuthors] = useState([])
useEffect(async function() {
var data = await axios.get("http://localhost:8080")
var xml = new XMLParser().parseFromString(data.data)
var formattedData = xml.children.map(function(author) {
return {
author_name: author.children[0].value,
title: author.children[1].value,
year: author.children[2].value
}
})
setAuthors(formattedData)
}, [])
return(
<div>
<AuthorList authors={authors} />
</div>
)
}
export default Home