replace with condition

To replace an item object in an array of objects, you can write the value key of the object you want to replace.

dispatch(replace('DESTINATION',CONDITION-VALUE,CONDITION-KEY))

Example: Replace User with id = 1 in Users

dispatch(replace('Users', { name: "Crawfish" }, 1, 'id'))

Last updated