score:1
Accepted answer
you may want to use tostring()
for your input
value
rather than storing string
in state. try this demo
render() {
return (
<div>
<div>
<input
step="1"
type="number"
name="code1"
value={this.state.code1.tostring()}
onchange={this.handlechange}
min="0"
max="100"
/>
</div>
<div>
<input
type="number"
name="code2"
value={this.state.code2.tostring()}
onchange={this.handlechange}
min="0"
max="100"
/>
</div>
<div>
<input
type="number"
name="code3"
value={this.state.code3.tostring()}
onchange={this.handlechange}
min="0"
max="100"
/>
</div>
<button onclick={this.handlereset}>reset</button>
</div>
)
}
Source: stackoverflow.com
Related Query
- ReactJS - SetState does not update the state when the state variable is a number
- React setState componentDidUpdate React limits the number of .. when trying to update the state based on updated state
- Im trying to build a menu that has collapsible options, but the dom does not update even when state data updates
- ReactJS UI Does Not Update The State
- NextJs Typescript - the component does not update when setState called
- setState does not set the state properly, when dropdown values changes
- reactJS <select> does not update the state
- It seems Axios does not update the state when use with async and await
- Reactjs state variable does not update
- I have the following problem when I delete a row in mySQL database, the serial number does not update to consecutive order
- Why does calling react setState method not mutate the state immediately?
- How do I update the state (using ReactJS) if I should not call setState in componentWillUpdate?
- Why getDerivedStateFromProps does not allow to re-render with the state update? Not a problem for componentWillReceiveProps - ReactJS
- React leaflet center attribute does not change when the center state changes
- React does not refresh after an update on the state (an array of objects)
- Style does not update when state is updated
- Calling setState with nested object does not update state correctly
- React hooks - setState does not update state properties
- React useState() hook does not update state when child.shouldComponentUpdate() returns false
- JavaScript filter does not update the React local state
- setState does not update state immediately inside setInterval
- Why does state not update correctly when calling setState() multiple times
- ReactJS useState hook: Can I update array of objects using the state variable itself?
- ReactJS best way to update the state with asynchronous setState
- React Hooks: updating state using useState does not update the state immediately
- ReactJS: State does not update upon onChange when initial state is from props
- React pagination does not update page data when page number is changed
- Reactjs parent state is not refreshed when the children input is changed
- ReactJS - REDUX - state display does not update
- React component does not update with the change in redux state
More Query from same tag
- Iam trying to use this.history.push to redirect to another page but its not working
- Updating react component when redux state changes
- Unable to update a table whenever a new changes happen without reloading page with redux
- Fit canvas to screen in React
- Fetch data from GET request
- React npm start not working : 'No version of chokidar available'
- Next.js making a timeout stop with a react state
- Some Tailwind styles not working in production with Next.js
- Fetching a data text from API response and presenting it in a chat with React
- with react final-form why is meta.touched always false with third party components?
- Using crypto-js in React
- File upload to custom folder in react
- Trying to expect a function to be called with Cypress and Sinon
- How do I combine a string + javascript for a className?
- Enzyme not selecting an onClick for a component
- react+redux: state of store changed without view changing
- Passing react props to a component and displaying
- passing file as prop in react typescript (Type 'true' is not assignable to type 'ChangeEventHandler<HTMLInputElement>)
- setState() does not re-render from my code
- JS Fetch - cannot get data from BadRequest response
- Background video not being displayed in React-Laravel App (API)
- How to reload page/router in handleSubmit method after submit?
- Reactjs Child Component
- how can i delete an entry from Dictionary data structure in Typescript based on the key?
- Default value in useState not getting re-initialised
- TypeError while including firebase in react App
- React Component crashes on reload
- why is my component getting rendered once but then failing on refresh
- Module not found: Error: Can't resolve 'crypto' in 'C:\
- Access and change the state array element in main React App from grandchild