title: how do i add a key-value pair to an object in state of functional components
body: <p>i've seen some stuff about computed property names for class components, is there a similar solution for functional components?</p>
  <p>i have an initial state of {}.</p>
  <pre><code>const [choice, setChoice] = useState({})
  </code></pre>
  <p>as a button clicks, i'd like to add a new k:v to it dynamically.</p>
  <pre><code>onClick={()=&gt;{ 
  setChoice( props.choice[Key]=[Val] );
  }
  </code></pre>
  <p>this doesn't seem to work...</p>
  <p>and i'm hoping to add to the choice variable, like so: {&quot;key&quot;:&quot;val&quot;,&quot;key1&quot;:&quot;val1&quot;,etc..)</p>
  <p>i've also tried this:</p>
  <pre><code>class Choice {
      constructor(key, value){
        this.key = key,
        this.value = value
      }
    }
  </code></pre>
  <p>but not sure how to adjust the onClick for it.</p>