score:0
i think you can remove this line
useeffect(() => {
setformdata({
checkbox1:checkbox})
}, [])
because it is calling setformdata again even though it's been changed in onchange function.
score:0
seemingly you are trying to spread array in a wrong way:
try to replace this:
tasks: {task,_id,date,checkbox}
with
tasks: [{ task, _id, date, checkbox }, { task: task2, _id: _id2, date: date2, checkbox: checkbox1 }]
Source: stackoverflow.com
Related Query
- Input field not updating from redux state but displays value on console.log in react
- React - input date field not updating value in state
- rule validation not triggered on input field when value is changed from React state
- I am trying to load data from redux store on click and updating the state, but the data from state is not getting updated on the click
- React + Redux - Input onChange is very slow when typing in when the input have a value from the state
- Using an input field with onBlur and a value from state blocks input in Reactjs JSX?
- Redux - State is updating but React components are not
- Axios not updating state from API in function called on Click, but works on identical function on Component Mount in React
- REACT + REDUX: on redux state change mapStateToProps updating state but view is not rendering as per new state
- React - ComponentDidMount not getting value from Redux state
- Input field value is not updating in react js
- Value from input field does not display
- Updating Parent component state from multiple child components not taking updated state value into account
- React: onChange not updating value to input field
- ReactJS | Prevent state array from updating on input field change
- Ant design Form validation is not working and not updating input values when component is from a state that is passed from a function
- Populate value in input field directly from redux store
- Redux/React - Search field is not updating the redux state instantly
- input value not updating when mutating state
- Console log response data returned data but not state
- State not updating on removing value from array in React JSX funcntional component
- State is getting input from user but not displaying on webpage in React.js
- React Redux store not updating on delete of an item from state
- Able to get the updated state from redux store but not able to access the objects inside the updated state from the receiver component
- Input field value is not updating in React form
- Update input value from state not working
- Redux reducer not updating prop value in React component from dispatch outside React components
- Redux Action is Dispatched but state not updating accordingly
- State value is not updating after passing a new value from children component
- Redux state is updated but UI is not updating
More Query from same tag
- unit testing a react component with mocha
- Is it optional to use value for input in Controlled component in React
- How to use pagination with React router v6
- How to pass an array of data to one component to another component using history.push in ReactJs when fetched using Axios
- How to get cropper size in react-cropper?
- react-router-dom v6 useHistory location.pathname
- Loop through objects and subtract different objects values
- ReactJS can only setState but cannot get state
- React map over the array object
- Error on import CSS for react-image-gallery with webpack
- Login validation- Getting validation errors
- How to set textarea value with line break in ReactJS
- How to fix setup error eslint/prettier config?
- override ::-webkit-scrollbar for a specific div in my react project
- Creating tickets using Zendesk api with React
- React child not re-rendered when parents props change
- How to filter value based on the nested array value?
- Exposing a method on a React Component
- What is the React.js way of handling visibility=hidden?
- solving error unauthorized /rest-auth/registration/ in django allauth
- Rails Webpacker React: /bin/webpack-dev-server The command moved into a separate package: @webpack-cli/serve
- SetState with nested ternary expression
- VictoryChart / VictoryLine ignores padding setting
- React useState variable doesn't get copied by value
- Save state of multiple Dynamic Components on ReactJS
- How can I declare media queries inside styled components as an object to assign to style?
- How to set default Checked in checkbox ReactJS?
- REACT + REDUX: on redux state change mapStateToProps updating state but view is not rendering as per new state
- How to test components internal functions with React testing library
- React router not working with params