I have to put a number in state (1400000) and then do mathematical operations with it. Problem is, I need the format of the number to be displayed as: "1.400.000". I thought about a Regex, but I have no idea how to implement it. Any ideas?
class MyComponent extends React.Component {
constructor() {
super()
this.contentEditable = React.createRef();
this.state = {html: "1400000", size: 380};
};
handleChange = evt => {
this.setState({html: evt.target.value});
};
render = () => {
return
<div><ContentEditable
innerRef={this.contentEditable}
html={this.state.html}
disabled={false}
onChange={this.handleChange}
/>
<p>{this.state.price/this.state.size}</p>
};
};