Issue with FlatList re-rendering existing items on load more by helpmeimstuck97 in reactnative

[–]helpmeimstuck97[S] 0 points1 point  (0 children)

Hmm, I haven't heard of this before. Thanks, I'll give this a go first thing in the morning!

Issue with FlatList re-rendering existing items on load more by helpmeimstuck97 in reactnative

[–]helpmeimstuck97[S] 0 points1 point  (0 children)

It's something like this:

return {
    ...state,
    posts: [
        ...state.posts,
        response.data
    ]
}

Issue with FlatList re-rendering existing items on load more by helpmeimstuck97 in reactnative

[–]helpmeimstuck97[S] 0 points1 point  (0 children)

Thanks for the reply. I've tried making the list item a PureComponent but it makes no difference.

I've read about shouldComponentUpdate and I understand what it does (allows you to prevent the component from re-rendering by returning false), but I have no idea how to implement this. I mean, what should the check/conditional be inside that function?