title: ReactJS how to limit the input value inline?
body: <p>I need to limit the possible input values to [0,1,2] but I would really like to do it inline to avoid further issues with my code.</p>
  <p>This is my input :</p>
  <pre><code>&lt;input
   className=&quot;form-control&quot;
   name=&quot;labelPred1&quot;
   type=&quot;text&quot;
   value={this.state.jsondata.prediction2[k]}
   onChange={e =&gt; this.onPred2Change(k, e.target.value)}
  /&gt;
  </code></pre>
  <p>I think it won't be possible to do it inline because with my research I found that I should check the content using <code>.match(regex)</code> in my <code>onPred2Change()</code> function, but maybe someone know how to do that directly in the <code>&lt;input&gt;</code> tag</p>