Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mutative wrapper with full Immer API compatibility

License

NotificationsYou must be signed in to change notification settings

exuanbo/mutative-compat

Repository files navigation

npmnpm bundle sizeGitHub Workflow Status (with branch)Codecov branch

Mutative wrapper with fullImmer API compatibility.

Installation

# npmnpm install mutative-compat mutative# Yarnyarn add mutative-compat mutative# pnpmpnpm add mutative-compat mutative

Optional but useful 😈:

// package.json{"dependencies":{"immer":"npm:mutative-compat@^0.1.x","mutative":"^1.0.2",},// npm"overrides":{"immer":"npm:mutative-compat@^0.1.x"},// Yarn"resolutions":{"immer":"npm:mutative-compat@^0.1.x"},// pnpm"pnpm":{"overrides":{"immer":"npm:mutative-compat@^0.1.x"}}}

This way you can replaceimmer withmutative in some opinionated libraries like Redux Toolkit.

Differences from Immer

  • Thefreeze function will only freeze shallowly, the second argumentdeep?: boolean is omitted.
  • In nestedproduce calls, the inner results will never be frozen even if they're not used in the outer recipe.

For other differences(that you probably will never notice), seemutative/test/immer-non-support.test.ts

License

MIT License @ 2023-PresentXuanbo Cheng

About

Mutative wrapper with full Immer API compatibility

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp