Property 'map' does not exist on type 'never' --> React with Axios

21 Views Asked by At

I get a warning (see picture) and I have tried everything to fix it. I understand a map or filter can't exist on 'never' but with the 'fetchAPI?' question mark should in my mind fix the problem. Any suggestions?

See pictures!

The useState const The error message

I have tried:

 const [fetchAPI, setFetchAPI] = useState('')
 const [fetchAPI, setFetchAPI] = useState([])
 const [fetchAPI, setFetchAPI] = useState()
 const [fetchAPI, setFetchAPI] = useState(null)
 const [fetchAPI, setFetchAPI] = useState('' || [] || null)

None of those work:))

0

There are 0 best solutions below