title: react-native combining two arrays into one
body: <p>I am trying to let users select their interest (i.e, food, sports) and then display it on users profile page.</p>
  
  <p>I have two separate views. One is where users select their favorite food and in the next page user could select their favorite sports. </p>
  
  <p>So for example, I want to show <code>Interest: pizza, hotdog, basketball, surfing</code> on screen. </p>
  
  <p>The problem I am having is that I can't merge two arrays(food and sports).</p>
  
  <pre><code>class UserInterest extends Component {
      constructor(props){
         super(props)
         this._favoriteFood = this._favoriteFood.bind(this)
         this._favoriteSports = this._favoriteSports.bind(this)
  
       this.state = {
          food:[],
          sports:[],
          interest:[],   
       }
      } 
  
       _favoriteFood(foodState){
          const food = foodState
          this.setState({toggle1:food})
          console.log(food)
          console.log(this.state.food)
        }
  
       _favoriteSports(SportsState){
          const sports = SportsState
          this.setState({toggle2:sports})
          console.log(sports)
          console.log(this.state.sports)
        }
  
  render(){
   const {toggleText1} =this.state
   const {toggleText2} =this.state
  
  return (
  &lt;View&gt;
        &lt;FavoriteFood favoriteFood={this._favoriteFood}/&gt;
  &lt;/View&gt;
         &lt;View&gt;
               &lt;FavoriteSports favoriteSports={this._favoriteSports}/&gt;
         &lt;/View&gt;
         &lt;View&gt;
               &lt;Text&gt;{toggleText1}&lt;/Text&gt;
         &lt;/View&gt;
                 &lt;View&gt;
                       &lt;Text&gt;{toggleText2}&lt;/Text&gt;
                 &lt;/Vie&gt;
  )
  }
  </code></pre>
  
  <p>If I have two arrays <code>food:[pizza, hotdog]</code> and <code>sports:[basketball, surfing]</code> How could I merge these two arrays and put it in <code>interest:[]</code>array? </p>
  
  <p>Also when I <code>console.log(food)</code> I get array data, but when I <code>console.log(this.state.food)</code> I get an empty array. Shouldn't these be the same? I am confused.</p>
  
  <p>Any advise or comments would be really appreciated thanks in advance!</p>