✅ – Alforoan – 05-35 Jan 4
So I've rendered a bunch of movies from an api and would like a button (that each movie has) to change its state (prev => !prev) every time i click on a button but only for one movie not all. I've tried filtering by passing in id but the warning says encountered two children with same key(id) and idk how to fix that
44 Replies
this is what i have
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
like i fetched the api and made a component that renders each movie
kinda like that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
button, image, title, date
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i have it on the same page
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
they r all on the same page
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well im not sure if i know 100% what u mean
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i have a state thats set as false
its set to true if i click on that button
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh i see what u mean
how would i do that tho
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i think thats p simple
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
fk. i cant combine the two?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so i need to have app.js that renders <Movies />
and Movies.js will render <Movie/>
?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
also how did u do the color thing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Attaching Code
Please don't post code in screenshots or post unformatted code. Instead, use one of these preferred methods to share code:
```js
// short code snippets go here
```
Link a Gist to upload entire files: https://gist.github.com
Link a Code Sandbox to share runnable examples: https://codesandbox.io/s
Link a Code Sandbox to an existing GitHub repo: https://codesandbox.io/s/github/<username>/<reponame>
Link a TypeScript Playground to share types: https://www.typescriptlang.org/play
Link a Snack to share React Native examples: https://snack.expo.io
o i see thx.
should that contain the state?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sry im kinda confused. y is the way i was doing originally not working?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well not really
so basically the purpose of that button is once i click on it i have an option to make it a favorite or add to my watch list
soi got it working my destructuring my id inside
but not sure y it does that
it still gives me the warning tho
💀
actually nvm it makes every movie pop out the two buttons
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ya i still get this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ok , but it still not working
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah ofc
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i finally got it working by making Movies.js and Movie.js as u said earlier.
thank u
This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1060068952253927456
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1060068952253927456
Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question:
https://stackoverflow.com/help/how-to-ask
http://wp.me/p2oIwo-26