How To Display State In Flatlist Reactnative/react?
I have record state in my react native app. state{ record:[] //some data inside, When i console my state it looks like this: } Console output of my record state: Array [ Obj
Solution 1:
It happens because you have 2 different arrays inside this.state.record. Try to spread your data arrays inside state or combine them into 1 union array. Your this.state.record should look like this
state = {
records: [
{ name: 'xyz', age: '23', },
{ name: 'abc', age: '27', },
]
This will show you list with 2 objects
console.log('STATE RECORDS', this.state.records)
// console.log outputSTATERECORDS [
{ name: 'xyz', age: '23', },
{ name: 'abc', age: '27', },
]
Post a Comment for "How To Display State In Flatlist Reactnative/react?"