How to use the immer.produceWithPatches function in immer

To help you get started, we’ve selected a few immer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidkpiano / xstate / packages / xstate-immer / src / index.ts View on Github external
export function patchEvent(
  type: string,
  context: TContext,
  recipe: (draftContext: TContext) => void
): PatchEventObject {
  return {
    type,
    patches: produceWithPatches(context, recipe)
  };
}

immer

Create your next immutable state by mutating the current one

MIT
Latest version published 7 months ago

Package Health Score

93 / 100
Full package analysis