title: React - Format input field to show currency using Dinero.js
body: <p>I'm building a form in react that has a few inputs that need to format with money currency. So it needs to prefix with the <code>$</code>, add commas, decimals (2 decimal point).</p>
  
  <p>I found this library called <code>dinerojs.com</code>: <a href="https://dinerojs.com/" rel="nofollow noreferrer">https://dinerojs.com/</a> .</p>
  
  <p>I'm not sure what I'm doing wrong, but it's not formatting. The field works how it is now, but with no formats. Any ideas?</p>
  
  <pre><code>//State
  ProductPrice1: number,
  
  //Set inital state
  ProductPrice1: Dinero({ amount: 0 }).toFormat('$0,0.00'),
  
  //handle bind
  this.handleChangeProductPrice1  = this.handleChangeProductPrice1.bind(this);
  
  //Change function
  handleChangeProductPrice1y = async (event: any) =&gt; {
      const value = parseFloat(event.target.value)
      await this.setState({ ProductPrice1: value });      
  }
  
  //in my render
  &lt;input
      value={this.state.ProductPrice1}
      onChange={this.handleChangeProductPrice1}
      type="number"
      className="phone validate"
      name="ProductPrice1"                                        
  /&gt;
  </code></pre>