score:2
It may be a stale closure issue, could you try the following:
const getSelectedStatus = ({ key }) => {
setData((data) => {
const actionStatusId = key;
const selectedFilters = {
...data.selectedFilters,
actionStatusId,
};
return { ...data, selectedFilters };
});
};
const getSelectedCategory = ({ key }) => {
setData((data) => {
const actionCategoryId = key;
const selectedFilters = {
...data.selectedFilters,
actionCategoryId,
};
return { ...data, selectedFilters };
});
};
Source: stackoverflow.com
Related Query
- Unable to update nested state react
- Unable to update state on a nested object in React
- i am new to redux and react i am trying to update the nested state in REDUX store, but unable to sort it out
- How to update nested state properties in React
- React hooks: How do I update state on a nested object with useState()?
- What's the best alternative to update nested React state property with setState()?
- React State update a nested array with objects based on the id when iterated
- How to update the state of nested json object in react using hooks
- React - update nested state (Class Component)
- Update a nested state in a reducer React Redux
- Update nested react redux state
- unable to update react app's state
- react redux update state from loop in nested array
- Update Nested state in react
- Unable to update the state when button inside table cell clicked , React Ant Design
- Update react State array of nested objects
- React update nested object in state with variables identificator
- Update nested react state object with new arbitrary object
- How to update a nested react state
- how to update nested state array and then return the entire array react
- React Hooks unable to update state
- Unable to update the state value in React Js forms
- React update state with nested object
- React Immutable Generic Arrow to update a nested state of controlled fields
- How to update a state of infinite nested array in React JS
- Unable to push data to array and eventually update the state in react js
- React setState : unable to update state object
- React functional component test file unable to update state value and call its props function
- Unable to update a nested object within state
- Unable to update state (Array of Objects) : React
More Query from same tag
- How can I filter these data per month?
- How do I get user's location via navigator.geolocation before my fetch executes in componentDidMount() in react.js?
- How to re-render a react component after returning something in a function?
- react-router v4 and NavLink - routes need to be in a separate component
- Redux unwanted effect on .splice()
- i don't inderstand the problem in my first redux counter
- Set color from object on the basis of key to radio button on "map" REACT/Materialui
- React-Typescript: I don't find the problem why my getCurrentTime Function won't work
- styled components : using css to add colour based on values
- How to restrict end date before start date after selected start date in React.JS or in html input type=date""
- How do I convert html with jsx to jsx in React.js
- ReactJS TypeError: Cannot read property 'value' of undefined
- ReactJS many tables from one data array/json/request from DB
- In React is there a way to remount a component with a button click from another component?
- Return an object with a function
- Changing the backgroundColor of react mateial-ui Select MuiList
- Editorjs custom block renders twice on click when made as default block in react project
- React.cloneElement: pass new children or copy props.children?
- Why redux diff says that states are equal even though ther are not
- How can we update the state of a dynamic object array, based on the index
- get name and current value from a check box : react js
- React Search by object key
- React Conditional Render with object mapping and extra components
- Empty ghost Popup when dynamically rendering popup in react-leaflet
- Name webpack chunks from react-loadable
- Async await is not waiting for response inside useEffect
- create-react-app returns an Error: Cannot find module 'react-scripts/scripts/init.js' when executed
- Global outlined override
- Using react-router to redirect upon form submission
- How to add new class to only one element in map using scroll event