title: how to add a new object as a value to an array in the react state
body: <p>I would like to add a new value to the array within the react state, but I have encountered errors along the way, could anyone guide me with the solution?   </p>
  
  <pre><code>class App extends Component {
        constructor(props) {
          super(props);
          this.state = {
            Items: [
              {w:1, b:8, name: 'banana'},
              {w:7, b:3, name:'apple'},
              {w:3, b:5, name:'kiwi'},
              {w:6, b:3, name:'strawberry'},
              {w:5, b:1, name:'orange'}]
          };
        }
  
      addItem(weight, benefit, itemName){
        this.setState(prevState =&gt; ({
          Items: [...prevState.Items, {w:weight, b:benefit, name: itemName}]
        }))
      }
  </code></pre>