score:1
Accepted answer
i see that you are mutating the state directly by using
let formvalues = this.state.formvalues;
formvalues[name] = value;
one way to alleviate this issue is to spread the formvalues before assigning
let formvalues = {...this.state.formvalues};
or you can use immer
Source: stackoverflow.com
Related Query
- Form data binding with repeated forms in React
- React with Firebase - submitting Formik form data
- react native post form data with object and file in it using axios
- Best way to submit FORM data with React Redux?
- react formik - fill form inputs with data after http request
- How to pass data from React Form -> Flask Backend -> React Component (does it have something to do with CORS)?
- Unit test form submission with data using react testing library
- Uploading image with form data in React
- React - Axios POST form data with files and strings
- Two way data binding in React with Hooks
- Rendered more hooks than during the previous render. when posting form data with React Hooks
- Populate a React form with data if it exists
- React with Antd Form onFinish not retrieve data
- React Forms : How to make input data as list objects with same input name?
- How to send form data with react
- React useEffect(), fetch data with React Hooks and set the formik form
- React Hook Form Register Different Forms With Same Field Names
- I am using React Hook Form with Typescript, string does not accept incoming data
- Storing React form data in a nested object with useState
- Populate Meteor React form with existing data
- Request failed with status code 500 error. When making form post of multiForm data in React
- React - using nested objects as state with hooks to fill form data
- Submit a form with data using a custom React hook
- Sending form data with react Router from a Component to another
- React steps app, wizard with data between steps forms
- Meteor React populate form with existing data
- Two-Way Data Binding With Meteor and React
- fetch request with form data for auth react
- Console.log data entered in a form with React js
- React form not filling out with fetched data
More Query from same tag
- React: set State or set Prop without a Rerender
- Why won't my header component update when the context changes?
- failed to "removeChild" coming in react while dynamically updating an array
- nested array if value is equal add object to array in state
- React theming with css descendant selectors
- React JS - Reading environment configurations from external property file
- Passing second argument (ownProps) to mapDispatchToProps - is a bad pactice?
- Handling selection of buttons + adding selected items to new array
- styled-components conditional props doesn't work in Material-ui components
- ReactJS: Go to anchor link in HTML with react router dom only after the full page load
- React/Redux Component, need to populate a certain number of fields based on dropdown selection
- Material-UI dialog overlay?
- Component not updating when I change the props that I pass to it in React
- How to delay a component render in React?
- How to start React project with HTTPS
- Test custom hook with react-hooks-testing-library
- How to use react-toggle with React redux-form?
- warning Expected an assignment or function call and instead saw an expression
- How to disable an <a> tag in React after clicking it?
- Why does the same code renered in React and in plain CSS provide different results:
- ReactJS component functions
- How to highlight the selected menu item
- javascript: Fetch and display youtube thumbnail in real time when user types a url
- React function enter twice in if condition inside Map function
- Date is off by one day on server but not on localhost
- React Props wont update in Child Components
- Update React context from child component
- onClick inline function works different from outside function
- Redirect with React Functional Components
- Object Type in Typescript