title: ReactJS set dynamic input value based on Object
body: <p>I have an Object like this: </p>
  
  <p><a href="https://i.stack.imgur.com/btU8e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/btU8e.png" alt="enter image description here"></a></p>
  
  <p>And an object like this: </p>
  
  <pre><code>const subjectQuantities = {
        9: 2,
        11: 1,
      };
  </code></pre>
  
  <p>Where 9 and 11 are similar to the object <code>id</code> of first <code>Object</code> what I want to do is set the value of an input field dynamically so what I did is this: </p>
  
  <pre><code>{ Object.keys(subjects).map((item, i) =&gt; (
     &lt;li className="travelcompany-input clearfix" key={i}&gt;
        &lt;span className="input-label"&gt;{ subjects[item].name }&lt;/span&gt;
           &lt;div className="input-group"&gt;
             { subjects[item].id in subjectQuantities ?
              &lt;input className="form-control form-travelcompany-input" type="text" value=*DYNAMIC VALUE* min="0" max="10" /&gt;
               : &lt;p&gt;TEST&lt;/p&gt;
               }
           &lt;/div&gt;
     &lt;/li&gt;
  ))} 
  </code></pre>
  
  <p>How do I set the value of this input field dynamically based on the value of the subjectQuantities object.</p>