Loading....
save

TypeScript error: Property 'map' does not exist on type 'never'

clock icon

asked 2 months ago

message icon

1

eye icon

329

I am getting this error when trying to map over an array in TypeScript.

1const [items, setItems] = useState([]);
2// Error here:
3items.map(item => ...)
1const [items, setItems] = useState([]);
2// Error here:
3items.map(item => ...)

How do I type the state correctly?

1 Answer

1

Please log in to answer this question

Top Questions