I am creating react-native app. I have an array and want to use value outside the looping. I have declared value in this.state={current\_cat\_id:'',} I have tried it in componentWillMount like:

```
componentWillMount() {
    var ids = [];
    this.props.data.map((dataImage,Index) => {
        dataImage['main-head'].map((subchild,Index2) => {
            ids.push(subchild['path'])  
            })

    })
    this.setState({current_cat_id: ids})
}

```

its returning blank page. is this right approch