title: Input number format in React
body: <p>i wonder how i can format automatically input value in react for the money based values. </p>
  
  <p>So i want to allow this type values: </p>
  
  <p>eg: if user will wan't to write;</p>
  
  <p>20 - it will be 20.00
  if 1000, it will be 1,000.000</p>
  
  <p>I wan't to prevent any other user inputs and show error if so. 
  How i can do it in react? </p>
  
  <p>I'm using react-table so my input some editable cell. Because of it's div behave like input: I Tried this: </p>
  
  <pre><code>&lt;div
            className="coastInput"
            contentEditable
            onBlur={e =&gt; {
              const re = /^[0-9\b,.]+$/;
              if (e.target.innerHTML == "" || re.test(e.target.innerHTML)) {
                this.setState({
                  isError: false
                });
                const data = [...this.state.data];
                data[cellInfo.index][cellInfo.column.id] = e.target.innerHTML;
                this.setState({ data });
  
                editedData.push({
                  total: this.state.data[cellInfo.index][cellInfo.column.id],
                  id: cellInfo.row._original.id,
                });
              } else {
                return (
                  this.setState({
                    isError: true
                  }),
                  alert("Just numbers allowed")
                );
              }
            }}
            dangerouslySetInnerHTML={{
              __html: this.state.data[cellInfo.index][cellInfo.column.id]
            }}
          /&gt;
  </code></pre>