{"_id":"mobx-react-lite@5.0.3","bugs":{"url":"https://github.com/mobxjs/mobx/issues"},"dist":{"shasum":"6bd00e1a760d93430ee5f5187481fa729b16e586","tarball":"http://registry-npm.ywwl.com/mobx-react-lite/download/mobx-react-lite-5.0.3.tgz","fileCount":41,"integrity":"sha512-8qT/d/8Cg8ljt+heKhoFHNoqgedyeSGzdTixT0lgbFMMFlWfHUcXHZ8UD63eQi3ELjkxaH1VU07lXWhRwM0cVA==","signatures":[{"sig":"MEQCIGPwaP+xDcsYyCmwcmGHJH3kVqx0hkaWS10gn3+mFoJyAiBByrA6REnUVR7NAOF8coRItXsEl3AnPPpkgjHe2ykxVg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDRzviic7NcraTQsoDXWuRFh4URtn3/p6m+YOrOakHDXQIhAJ/qq7/nJLLJE6poZWg7vJCEj9tA50ONmJqyhT5AP9lm"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/mobx-react-lite@5.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":291961,"size":43267,"noattachment":false,"key":"/mobx-react-lite/-/mobx-react-lite-5.0.3.tgz"},"main":"dist/index.js","name":"mobx-react-lite","type":"commonjs","types":"dist/index.d.ts","unpkg":"dist/mobxreactlite.umd.production.min.js","author":{"name":"Daniel K."},"module":"dist/mobxreactlite.esm.js","source":"src/index.ts","exports":{".":{"node":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"import":{"types":"./dist/index.d.ts","default":"./dist/mobxreactlite.mjs"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"react-native":{"types":"./dist/index.d.ts","default":"./dist/mobxreactlite.esm.js"}},"./src/*":"./src/*","./dist/*":"./dist/*","./package.json":"./package.json"},"funding":{"url":"https://opencollective.com/mobx","type":"opencollective"},"gitHead":"5dbb04a15f7eb0ef6b844904c43955357a9bbdfc","license":"MIT","scripts":{"lint":"eslint src/**/* --ext .js,.ts,.tsx","test":"jest","build":"rollup --config rollup.config.mjs","test:size":"import-size --report . observer useLocalObservable","build:test":"npm run build -- --environment TARGET:test","test:check":"npm run test:types","test:types":"tsc --noEmit","prepublishOnly":"npm run build -- --environment TARGET:publish"},"typings":"dist/index.d.ts","version":"5.0.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:12fad49b-c812-439f-8d2d-20767fad93ea"}},"homepage":"https://mobx.js.org","jsdelivr":"dist/mobxreactlite.umd.production.min.js","keywords":["mobx","mobservable","react-component","react","reactjs","reactive","hooks","observer","useLocalObservable"],"umd:main":"dist/mobxreactlite.umd.production.min.js","repository":{"url":"git+https://github.com/mobxjs/mobx.git","type":"git"},"_npmVersion":"11.17.0","description":"Lightweight React bindings for MobX based on function components and Hooks","directories":{},"jsnext:main":"dist/mobxreactlite.esm.production.min.js","maintainers":[{"name":"fredyc","email":"fredy.c@seznam.cz"},{"name":"mweststrate","email":"mweststrate@gmail.com"}],"_nodeVersion":"24.19.0","react-native":"dist/mobxreactlite.esm.js","_hasShrinkwrap":false,"devDependencies":{"mobx":"^7.0.3"},"peerDependencies":{"mobx":"^7.0.0","react":"^18 || ^19"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mobx-react-lite_5.0.3_1787155288654_0.40755301314189474"},"readme":"# mobx-react-lite\n\n[![CircleCI](https://circleci.com/gh/mobxjs/mobx-react-lite.svg?style=svg)](https://circleci.com/gh/mobxjs/mobx-react-lite)\n[![Coverage Status](https://coveralls.io/repos/github/mobxjs/mobx-react-lite/badge.svg)](https://coveralls.io/github/mobxjs/mobx-react-lite)\n[![NPM downloads](https://img.shields.io/npm/dm/mobx-react-lite.svg?style=flat)](https://npmjs.com/package/mobx-react-lite)[![Minzipped size](https://img.shields.io/bundlephobia/minzip/mobx-react-lite.svg)](https://bundlephobia.com/result?p=mobx-react-lite)\n[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)\n[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/mobx-react-lite)\n\nThis package supports React **function components only**. Use [mobx-react](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react) if you also need class component support. It is still possible to use `<Observer>` inside the render of class components.\n\n## Compatibility table (major versions)\n\n| mobx | mobx-react-lite | Browser                                        |\n| ---- | --------------- | ---------------------------------------------- |\n| 7    | 5               | Modern browsers with native Proxy support      |\n| 6    | 3               | Modern browsers (IE 11+ in compatibility mode) |\n| 5    | 2               | Modern browsers                                |\n| 4    | 2               | IE 11+, RN w/o Proxy support                   |\n\n`mobx-react-lite` version 5 requires React 18 or higher.\n\n## User Guide 👉 https://mobx.js.org/react-integration.html\n\n---\n\n## API reference ⚒\n\n### **`observer<P>(baseComponent: FunctionComponent<P>): FunctionComponent<P>`**\n\nThe observer converts a component into a reactive component, which tracks which observables are used automatically and re-renders the component when one of these values changes.\nCan only be used for function components. For class component support see the `mobx-react` package.\n\n### **`<Observer>{renderFn}</Observer>`**\n\nIs a React component, which applies observer to an anonymous region in your component. `<Observer>` can be used both inside class and function components.\n\n### **`useLocalObservable<T>(initializer: () => T, annotations?: AnnotationsMap<T>): T`**\n\nCreates an observable object with the given properties, methods and computed values.\n\nNote that computed values cannot directly depend on non-observable values, but only on observable values, so it might be needed to sync properties into the observable using `useEffect`.\n\n`useLocalObservable` is a short-hand for:\n\n`const [state] = useState(() => observable(initializer(), annotations, { autoBind: true }))`\n\n### **`enableStaticRendering(enable: true)`**\n\nCall `enableStaticRendering(true)` when running in an SSR environment, in which `observer` wrapped components should never re-render, but cleanup after the first rendering automatically. Use `isUsingStaticRendering()` to inspect the current setting.\n\n---\n\n## Removed APIs in version 5\n\n`useObserver`, `useLocalStore`, `useAsObservableSource`, `useStaticRendering`, batching imports, `observerBatching`, and `isObserverBatched` have been removed. Use `observer`, `<Observer>`, `useLocalObservable`, and `enableStaticRendering`; React 18 renderers handle batching.\n\n## Testing\n\nRunning the full test suite now requires node 14+\nBut the library itself does not have this limitation\n\nIn order to avoid memory leaks due to aborted renders from React\nfiber handling or React `StrictMode`, on environments that does not support [FinalizationRegistry](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry), this library needs to\nrun timers to tidy up the remains of the aborted renders.\n\nThis can cause issues with test frameworks such as Jest\nwhich require that timers be cleaned up before the tests\ncan exit.\n\n### **`clearTimers()`**\n\nCall `clearTimers()` in the `afterEach` of your tests to ensure\nthat `mobx-react-lite` cleans up immediately and allows tests\nto exit.\n","publish_time":1787155288796,"_cnpm_publish_time":1787155288796,"dist-tags":{"alpha":"4.0.7-alpha","beta":"3.0.0-beta.1","experimental":"4.0.4-x1","latest":"5.1.2","next":"2.0.0-alpha.5"}}