I have tried so many ways to get the correct type for useState when setting an array of objects as the data.
I am pulling in data from an api and setting it using setState on a button press. But for the life of me cant work out how to define the type so typescript does not scream at me.
The error is being shown where I map the countryData in the JSX.
full Error is "Type 'void[]' is not assignable to type 'ReactNode'. Type 'void[]' is not assignable to type 'ReactFragment'. The types returned by 'Symbol.iterator.next(...)' are incompatible between these types. Type 'IteratorResult<void, any>' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. Type 'void' is not assignable to type 'ReactNode'.ts(2322)"
Code is below.