{"name":"mobx-react-lite","version":"4.0.7-alpha","description":"Lightweight React bindings for MobX based on React 16.8+ and Hooks","source":"src/index.ts","main":"dist/index.js","umd:main":"dist/mobxreact.umd.production.min.js","unpkg":"dist/mobxreactlite.umd.production.min.js","jsdelivr":"dist/mobxreactlite.umd.production.min.js","jsnext:main":"dist/mobxreactlite.esm.production.min.js","module":"es/index.js","react-native":"es/index.js","types":"dist/index.d.ts","typings":"dist/index.d.ts","repository":{"type":"git","url":"https://github.com/mobxjs/mobx.git"},"author":{"name":"Daniel K."},"license":"MIT","funding":{"type":"opencollective","url":"https://opencollective.com/mobx"},"bugs":{"url":"https://github.com/mobxjs/mobx/issues"},"homepage":"https://mobx.js.org/","dependencies":{"use-sync-external-store":"^1.2.0"},"peerDependencies":{"mobx":"^6.9.0","react":"^16.8.0 || ^17 || ^18","react-dom":">=16.8.0"},"peerDependenciesMeta":{"react-dom":{"optional":true},"react-native":{"optional":true}},"devDependencies":{"mobx":"^6.12.2","expose-gc":"^1.0.0"},"keywords":["mobx","mobservable","react-component","react","reactjs","reactive","hooks","observer","useLocalObservable"],"scripts":{"lint":"eslint src/**/* --ext .js,.ts,.tsx","build":"node ../../scripts/build.js mobxReactLite","build:test":"yarn build --target test","build:cjs":"tsc --project tsconfig.build.cjs.json","build:es":"tsc --project tsconfig.build.es.json","test":"jest","test:size":"yarn import-size --report . observer useLocalObservable","test:types":"tsc --noEmit","test:check":"yarn test:types","prepublishOnly":"cd ../mobx && yarn build --target publish && cd ../mobx-react-lite && yarn build --target publish && yarn build:cjs && yarn build:es"},"readmeFilename":"README.md","licenseText":"The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"mobx-react-lite@4.0.7-alpha","dist":{"shasum":"4297ed388ac3f5679f339a5923764d36eb892edb","integrity":"sha512-d+tCsSme0p/MY8CsLQWNewzWzZzVvbIaTnQKkELpl8KRX5WxV1dIR0yw08R/Zo21KF998OaoAM2vjC5ch7OahA==","tarball":"http://registry-npm.ywwl.com/mobx-react-lite/download/mobx-react-lite-4.0.7-alpha.tgz","fileCount":127,"unpackedSize":408264,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICF3UkcGzvhDWwWoVWQ85/r1/Rnkv8WAB7/BBCmw9pzPAiEA0boo/kF2oikTN2e2YIkWgPdsPPPHIqO8TJ3udu9Z9Lc="}],"size":99187,"noattachment":false,"key":"/mobx-react-lite/-/mobx-react-lite-4.0.7-alpha.tgz"},"_npmUser":{"name":"mweststrate","email":"mweststrate@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mobx-react-lite_4.0.7-alpha_1721245915025_0.9257230479253136"},"_hasShrinkwrap":false,"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":1721245915210,"maintainers":[{"name":"fredyc","email":"fredy.c@seznam.cz"},{"name":"mweststrate","email":"mweststrate@gmail.com"}],"_cnpm_publish_time":1721245915210,"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"}}