Search code examples
firebasereact-nativereact-native-flatlist

display data from multiple state in flatlist react native


I am fetching data from two collection from firestore. and set data as two state in componentDidUpdate(). now I want to display those state as flatlist data as data props of flatlist. how can I Achive this?


Solution

  • In the FlastList data prop you can send something like [...state1, ...state2]

    <FlatList data={[...state1, ...state2]} renderItem={renderItem} />