How to force Flatlist to re-render after getting a single data?

前端 未结 1 1558
孤街浪徒
孤街浪徒 2020-12-12 07:27

I\'ve faced an issue with flatlist when I get single data from the server and set these into state and passes into data props, I can\'t see any update in the render \"I\'m a

相关标签:
1条回答
  • 2020-12-12 08:08

    to force the flatlist re-render. just add a boolean lets say "forceUpdate" to your state and whenever an item is added to flatlist data toggle that boolean and pass that to the extra data of your FlatList instead of the state.

    0 讨论(0)
提交回复
热议问题