Q:

How to re-initialise (state) array variable in react-native?

I'm making an API call.
And I'm getting response as : 
var data =
[
    {a: 'a', b: 'b'}
]

And I want to set value of variable in state as data.
But it's not working . Giving error as =>

Objects are not valid as a React child
Ex: -
state = {
stateVariable: []
}
apiCall.then((data) => {
  this.setState({ stateVariable: data  })
})

A:

Objects are not valid as a React child

In react, you cannot render an object directly.
I feel you are trying to do something like this
<Text>{this.state.stateVariable}</Text>

It will not work because the value in there is an array.
To fix this, you can map it:
{this.state.stateVariable.map(data => <Text>{data.a} {data.b}</Text>)}

Secondly, You may already be mapping it or looping it but you're still getting the error. This is because if you render just data as in my map above, it is an object {a:'a', b:'b'} and this is not allowed in react. 
So you have to make it {data.a} or {data.b}

