1"use strict";(self.webpackChunkmy_website=self.webpackChunkmy_website||[]).push([["405"],{44217:function(e,t,n){n.r(t),n.d(t,{frontMatter:()=>o,toc:()=>l,default:()=>c,metadata:()=>r,assets:()=>d,contentTitle:()=>a});var r=JSON.parse('{"id":"npm \u5305/immer","title":"immer","description":"Create by fall on 22 Mar 2023","source":"@site/my-docs/npm \u5305/immer.md","sourceDirName":"npm \u5305","slug":"/npm \u5305/immer","permalink":"/docs/npm \u5305/immer","draft":false,"unlisted":false,"editUrl":"https://github.com/fall-zhang/fall-zhang.github.io/tree/source/my-docs/npm \u5305/immer.md","tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"husky","permalink":"/docs/npm \u5305/husky"},"next":{"title":"jest","permalink":"/docs/npm \u5305/jest"}}'),s=n(52676),i=n(97806);let o={},a=void 0,d={},l=[{value:"Immer",id:"immer",level:2},{value:"\u53C2\u8003\u6587\u7AE0",id:"\u53C2\u8003\u6587\u7AE0",level:2}];function m(e){let t={a:"a",blockquote:"blockquote",code:"code",h2:"h2",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.blockquote,{children:["\n",(0,s.jsxs)(t.p,{children:["Create by ",(0,s.jsx)(t.strong,{children:"fall"})," on 22 Mar 2023",(0,s.jsx)("br",{}),"\nRecently revised in 22 Mar 2023"]}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"immer",children:"Immer"}),"\n",(0,s.jsx)(t.p,{children:"\u4E0D\u53EF\u53D8\u6570\u636E\u5DE5\u5177\uFF0C\u5F53\u9700\u8981\u4E00\u4E9B\u5386\u53F2\u5DE5\u5177\uFF0C\u6216\u8005\u5BF9\u5386\u53F2\u8FDB\u884C\u5904\u7406\u7684\u65F6\u5019\u9700\u8981\u7528\u5230 immer"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",children:"import produce from 'immer'\nlet state = {\n name: '',\n address: ['']\n}\nconst history = []\nhistory.push(state)\nstate = produce(state,(draft)=>{\n draft.address.push(996)\n})\nhistory.push(state)\n"})}),"\n",(0,s.jsx)(t.h2,{id:"\u53C2\u8003\u6587\u7AE0",children:"\u53C2\u8003\u6587\u7AE0"}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:"\u4F5C\u8005"}),(0,s.jsx)(t.th,{children:"\u6587\u7AE0\u540D\u79F0"})]})}),(0,s.jsx)(t.tbody,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:"immer \u5B98\u65B9\u6587\u6863"}),(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"https://immerjs.github.io/immer/zh-CN/update-patterns",children:"https://immerjs.github.io/immer/zh-CN/update-patterns"})})]})})]})]})}function c(e={}){let{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(m,{...e})}):m(e)}},97806:function(e,t,n){n.d(t,{Z:()=>a,a:()=>o});var r=n(75271);let s={},i=r.createContext(s);function o(e){let t=r.useContext(i);return r.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.