- Forums
- Typescript
- react typescript map() parameters define type of value and object JSX
how to solve typescript errors when dealing with map() function in react jsx [5201], Last Updated: Mon Jun 24, 2024
cathy
Fri Sep 08, 2023
0 Comments
280 Visits
I was getting an erro with this code:
{Object.entries(obj).map(([item, result], index2) => {
Error: 'result' is of type 'unknown'.ts(18046)
and this how I changed it to get rid of the errors in my react typescript application:
{Object.entries(obj).map(([item, result]:any, index2) => {
Do you see the difference? Yes :any,