const $merge: <T>($merge: T) => Update<T>
Merge two values. This is the default behavior for objects, so exists mostly for clarity.
import { $merge } from "@use-gpu/state";
const value = {
hello: {text: 'world', bar: 2},
foo: 1,
};
const update = {
hello: $merge({text: 'test'}),
};
expect(patch(value, update)).toEqual({
hello: {text: 'test', bar: 2},
foo: 1,
});
packages / state / src / patch.ts