title: How to set array values into state in React JS
body: <p>I have an array of objects named <code>resultArray</code> like</p>
  
  <pre><code>[
    {
      "name": "Morgan",
      "category": "on",
      "dept": "A1"
    },
    {
      "name": "Lewis",
      "category": "on",
      "dept": "A2"
    },
    {
      "name": "Ivan",
      "category": "off",
      "dept": "A3"
    }
  ]
  </code></pre>
  
  <p>In my API result. How can I set them into <code>state</code> to get the result as </p>
  
  <pre><code>this.state = { 
    person: [
      {
        "name": "Morgan",
        "category": "on"
      },
      {
        "name": "Lewis",
        "category": "on"
      },
      {
        "name": "Ivan",
        "category": "off"
      }
    ]
  };
  </code></pre>