title: how can I use a state as an array of objects
body: <p>I have recently started learning React TypeScript, and I am trying to make a Bowling Score application. I thought about state (I don't know much about states, just started learning it)  so I can put an array of object inside the state and use it which will make the values in each frame changes when I press the roll buttons. This is my code :</p>
  <pre><code>  type frame = {
      leftScore: any;
      rightScore: any;
      lastFrameScore: any;
      totalScore: any;
  }
  const game = new Game();
  const [score , setScore] = useState&lt;frame[]&gt;([]);
  
  function App() {
      setScore({score : game.score}); // got error here
  
      return (
  
          &lt;div className='container'&gt;
              &lt;div className=&quot;RollsContainer&quot;&gt;
                  &lt;h1&gt;hi &lt;/h1&gt;
                  {[...Array(11)].map((e , i) =&gt;
                      &lt;button key={i} onClick={() =&gt; handleRolls(i)}&gt;{i}&lt;/button&gt;
                  )
                  }
              &lt;/div&gt;
              &lt;div className=&quot;frameContainer&quot;&gt;
  
  
                  {[...Array(10)].map((e , i) =&gt;
  
                      &lt;Frame
                          framenbr={i + 1}
                          leftbox={score[i + 1].leftScore}
                          rightbox={game.score[i].rightScore}
                          lastbox={game.score[i].lastFrameScore}
                          totalScore={game.score[i].totalScore}
                          key={i + 1}/&gt;)
                  }
  
              &lt;/div&gt;
  
  
          &lt;/div&gt;
      )
  
  }
  </code></pre>
  <p>this is game class:</p>
  <pre><code>export class Game {
      curentFrame: number;
      roll: any;
      score: frame[] = [];
  
      constructor() {
          this.curentFrame = 0;
  
          for (let i = 0; i &lt;= 10; i++) {
              this.score[i] = {
                  leftScore : '' ,
                  rightScore : '' ,
                  lastFrameScore : '' ,
                  totalScore : '' ,
              };
          }
  
  
      }
  }
  </code></pre>
  <p>I got this error</p>
  <pre><code>Error:(15, 15) TS2345: Argument of type '{ score: frame[]; }' is not assignable to parameter of type 'SetStateAction&lt;frame[]&gt;'.
    Object literal may only specify known properties, and 'score' does not exist in type 'SetStateAction&lt;frame[]&gt;'.
  </code></pre>
  <p>I don't know if this is right or wrong I tried so many solutions but did not work</p>