-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot destructure react component props #9110
Comments
Certainly seems straightfoward. Seems bad, but will need to take a closer look. |
This is related to not setting a key. Why this happens though is something I'm still investigating. But it's matter of missing the key, and it's giving you a bad error message. |
I think the way our code works is shadowing the warning from coming through. Looking into a fix. |
After adding a key prop, it works. |
This was quite the rabbit hole. Fixing/adding the |
+1, took me a long time to arrive here. Adding the key, worked. Important mention: I was using on my index.astro, and it was only on the first render. |
I just tried to migrate from v2 to v4 and i'm getting this error. Using |
never mind, it was |
What do you mean by adding a keyprop @izmttk ? I already try to use a default value to the prop in the react component, but instead of giving the error is saying: " Astro detected an unhandled rejection. Here's the stack trace: Edit: Nvm, I already realized it. I have an array where it is mapped into the component and does not have its own key to every item mapped. |
Is anyone still running into this issue? It seems cleared up when I use 4.8. |
@matthewp I just hit this running trace starts around @astrojs/react/server.js I was using it with |
Hitting this issue in astro v4.14.5 & astro/react v3.6.2
|
FYI, React, in dev mode, does two initial renders, so it might be related to that (last time I heard). Also, the issue seems different from OP. |
As of astro 5.1.2 this seems to be working, so I'm closing this. Please open a new issue if you can reproduce it with latest versions. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When running
astro dev
, I got an error "Cannot destructure property 'xxx' of 'undefined' as it is undefined" when using themap
method on React component props. It seems like this error has occurred before and has been resolved in #660 , but it's happening again.If I missed something, please let me know.
What's the expected result?
no errors
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-hrgerw
Participation
The text was updated successfully, but these errors were encountered: