How to prevent re-rendering of FlatList #16240
Labels
Ran Commands
One of our bots successfully processed a command.
Resolution: Locked
This issue was locked by the bot.
Hello.
I'm implementing chatting with FlatList.
Every time there is a new chat message detected, I do the following.
let newItem = {...}; // read a new chat message from server
let nextFlatListData = this.state.flatListData.slice(0); // clone the chat list
nextFlatListData.push(newItem); // add the new chat to the list
this.setState({flatListData: nextFlatListData}); // update FlatList
It seems that it re-renders every row.
I just need the row for newItem is rendered and the others are NOT re-rendered.
Thank you very much.
The text was updated successfully, but these errors were encountered: