how to insert a object with one change in setstate react code example
Example 1: copying state to object and editing it vs setting state
setFilters((filters) => (
produce(filters, draftFilters => {
if (param[0] === 'availability') {
draftFilters.availability = param[1]
} else {
draftFilters[param[0]] = parseInt(param[1], 10)
}
const params = produce(filters, draftFilter => {
draftFilter.page = page + 1;
})
Example 2: can we add new state property using setstate in react
How to become a pro with React setState() in 10 minuteswww.freecodecamp.org › news › get-pro-with-react-set...