英文:
How could I Type value inside my object to pass it as a props with react
问题
I discovered TypeScript and I would like to use it in my React App, because it's still possible but soon not.
So I was working on it, and for an hour, I'm stuck. I would like to know what's exactly wrong with it and what should I do?
To me, it's a type error. That's why I got 'Property 'name' does not exist on type 'never[]'.' But like I said, I'm a novice.
Is there someone to help me fix it and, most importantly, explain it to me a little bit?
Image of my code and the errors thrown
英文:
I discovered TypeScript and I would like to use it into my react App, cause it's still possible but soon not.
So I was working on and from an hour I'm stuck on it... I would like to know what exactly wrong with it and what should I do?
To me it's a type error that's why I got 'Property 'name' does not exist on type 'never[]'.' but like said I'm a novice.
Someone there to help me to fix it and most important explain to me a little bit?
答案1
得分: 0
你应该将你的常量数据指定为任何类型,像这样:const data: any{} = ...
英文:
You should specify your const data as any type, like this: const data: any{} = ...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论