insert
Last updated
Last updated
Insert function is used to insert an object, an array, or data to a node in the reducer tree.
There are 3 parameters: Destination: which could be a destination path or the name of the object you want to insert to. Object name: the name of the object Payload: the value of the object; it could be an object, array, or data.
Example 1:
We want to add an object { food: ‘crawfish’ }
to the User object.
Example 2:
Insert an array meal: ["crawfish", "corn", "hotdog", "shrimp"]
to the User