title: How to limit set the maximum decimal places of a number as 8 decimal places in React using javascript
body: <p>Im taking user input and trying to set the maximum amount of decimal places to 8 digits after decimal. I was researching this and I have seen solutions that tell me to do the javascript's .toFixed() method. However, I tried it and found that it will automatically tack on about 8 zeros into the input for whatever I input into the input field. For example if I type in 5 into the field, I would get the following in the input field: <code>5.00000000</code></p>
  <p>This is not the goal, as I just want to limit the amount of decimal places a user can input to 8. It is fine if it is less than that.</p>
  <p>Please see my code below. Thanks!</p>
  <pre><code>  const handleAmount = (value) =&gt; {
      const numberAmount = Number(value).toFixed(8);
      setAmount(numberAmount);
    };
  
            &lt;TextField
                className={classes.textField}
                type=&quot;number&quot;
                onChange={e =&gt; handleAmount(e.target.value)}
                value={amount}
                placeholder=&quot;0.000&quot;
                inputProps={{
                  maxLength: 8,
                  step: '.01'
                }}
                variant=&quot;outlined&quot; /&gt;
  </code></pre>