Comment on Anyone else get the thing where images and post titles become confused? It can often be humourous.
moseschrute@lemmy.world 1 day ago100% guessing here, but native apps sometimes use recycling virtualized lists. That means as you scroll the list will reuse the container that renders the post title and image. Often the image is still being fetched but you already know the title. So as you scroll, it reuses a post you previously saw, instantly swaps in the new title, but the new image is still landing so an image from a previously post in the list is displayed.
Idk if that made any sense at all, but keep an eye out if the title is new but the image was previously seen.
Kaboom@reddthat.com 1 day ago
Yeah, that’s why key props are important. And sanity checks too. But too many programmers these days just turn off eslint rules without understanding why they exist
moseschrute@lemmy.world 1 day ago
I’m not a recycling list expert, but I think the more keys you use the less react is able to reuse components in the list. So this is one area where keys are actually worse. You may be able to use them only on the image part of the post, but packages like expo-image have a recyclingKey prop you are supposed to use instead. But I found expo image to not work very well so 🤷
But I think think the app we were referring to isn’t react native? Idk how native recycling lists work tbh so maybe you’re right about the key thing.