最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: Cannot destructure property 'recipes' of 'props' as it is undef

programmeradmin2浏览0评论

I am a beginner in reactjs when I tried to run a program it showed the following error

Uncaught TypeError: Cannot destructure property 'recipes' of 'props' as it is undefined.
    at RecipeList (bundle.js:532:5)
    at renderWithHooks (bundle.js:22834:22)
    at mountIndeterminateComponent (bundle.js:25596:17)
    at beginWork (bundle.js:26795:20)
    at HTMLUnknownElement.callCallback (bundle.js:11784:18)
    at Object.invokeGuardedCallbackDev (bundle.js:11833:20)
    at invokeGuardedCallback (bundle.js:11893:35)
    at beginWork$1 (bundle.js:31635:11)
    at performUnitOfWork (bundle.js:30471:16)
    at workLoopSync (bundle.js:30408:9)

I am a beginner in reactjs when I tried to run a program it showed the following error

Uncaught TypeError: Cannot destructure property 'recipes' of 'props' as it is undefined.
    at RecipeList (bundle.js:532:5)
    at renderWithHooks (bundle.js:22834:22)
    at mountIndeterminateComponent (bundle.js:25596:17)
    at beginWork (bundle.js:26795:20)
    at HTMLUnknownElement.callCallback (bundle.js:11784:18)
    at Object.invokeGuardedCallbackDev (bundle.js:11833:20)
    at invokeGuardedCallback (bundle.js:11893:35)
    at beginWork$1 (bundle.js:31635:11)
    at performUnitOfWork (bundle.js:30471:16)
    at workLoopSync (bundle.js:30408:9)
Share Improve this question edited Apr 2, 2022 at 8:51 Andy 63.6k13 gold badges71 silver badges98 bronze badges asked Apr 2, 2022 at 8:43 MilanMilan 1831 gold badge3 silver badges15 bronze badges 2
  • Please add the code you've attempted to your question as a minimal reproducible example. Here's some documentation on how to create a React snippet. – Andy Commented Apr 2, 2022 at 8:44
  • when i tried to add my code it's showing ``` It looks like your post is mostly code; please add some more details``` – Milan Commented Apr 2, 2022 at 8:48
Add a ment  | 

2 Answers 2

Reset to default 3

One of your assignments is not properly transferred to a ponent, that is why it is "Undefined".

Upload the parts of the code related to this props code or alternative try it yourself with console.log(props): check what is defined and what is not. Then connect the two.

Maybe you used const { recipes } = props in your code, however, props are undefined, so you get the error destructure property.

Can you put your code there? And check that the props are not undefined. Check parent ponent send useful data to child ponent.

发布评论

评论列表(0)

  1. 暂无评论