react-numeric-input
react-numeric-input copied to clipboard
NumericInput value reset on setState
I'm using a numeric input value, changing its value, then later, calling a setState. This is causing the numericInput value to reset to its original value instead of repopulating. It seems this might be due to some sort of caching, is there a way to disable this?
Had the same issue, I added value={this.state.numericInput} onChange={this.onNumericInputChange} to the NumericInput:
<NumericInput ref='numericInput' className="form-control" style={false} placeholder='Number here' onChange={this.onNumericInputChange} value={this.state.numericInput} />
And set value in the state(implementation of onNumericInputChange): onNumericInputChange(value) { this.setState({ numericInput: value }); }
It helped me.
Can you provide an example so that I can try it?