{"name":"mobx-react-lite","version":"2.2.0-beta.0","description":"Lightweight React bindings for MobX based on React 16.8+ and Hooks","main":"lib/index.js","unpkg":"dist/mobxreactlite.umd.production.min.js","module":"es/index.js","types":"dist/index.d.ts","sideEffects":["batching*"],"repository":{"type":"git","url":"git+https://github.com/mobxjs/mobx-react-lite.git"},"scripts":{"prettier":"prettier --write \"./{src,test}/*.{js,ts,tsx}\"","lint":"eslint . --ext .js,.ts,.tsx","validate":"tsc --noEmit","test":"jest --watch","test:ci":"jest -i --coverage","size":"size-limit","coverage":"jest --coverage","prebuild":"rimraf dist lib es","build":"yarn build:commonjs && yarn build:es && yarn build:umd","build:commonjs":"tsc --project tsconfig.build.cjs.json","build:es":"tsc --project tsconfig.build.es.json","build:umd":"tsdx build --name mobxReactLite --format=umd --tsconfig tsconfig.build.es.json","release":"node publish.js"},"author":{"name":"Daniel K."},"license":"MIT","bugs":{"url":"https://github.com/mobxjs/mobx-react-lite/issues"},"homepage":"https://mobx-react.js.org","peerDependencies":{"mobx":"^4.0.0 || ^5.0.0","react":"^16.8.0"},"peerDependenciesMeta":{"react-dom":{"optional":true},"react-native":{"optional":true}},"devDependencies":{"@babel/core":"7.8.4","@babel/preset-env":"7.8.4","@size-limit/preset-small-lib":"2.1.6","@size-limit/time":"2.1.6","@testing-library/jest-dom":"4.1.2","@testing-library/react":"9.3.0","@testing-library/react-hooks":"1.1.0","@types/jest":"24.0.19","@types/node":"12.7.12","@types/react":"16.9.6","@types/react-dom":"16.9.2","@typescript-eslint/eslint-plugin":"^2.19.2","@typescript-eslint/parser":"^2.19.2","coveralls":"3.0.7","eslint":"^6.1.0","eslint-plugin-react":"^7.18.3","husky":"3.0.9","jest":"24.9.0","jest-environment-jsdom":"24.9.0","jest-mock-console":"1.0.0","mobx":"5.14.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","prompts":"^2.3.2","react":"16.13.1","react-dom":"16.13.1","react-test-renderer":"16.10.2","rimraf":"3.0.0","semver":"^7.2.2","shelljs":"^0.8.3","shx":"0.3.2","ts-jest":"24.1.0","tsdx":"0.12.3","typescript":"3.6.4"},"keywords":["mobx","mobservable","react-component","react","reactjs","reactive","hooks","observer","useObserver","useLocalStore","useAsObservableSource"],"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"dependencies":{},"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)[![Coverage Status](https://coveralls.io/repos/github/mobxjs/mobx-react-lite/badge.svg)](https://coveralls.io/github/mobxjs/mobx-react-lite)[![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\n[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n[![Join the chat at https://gitter.im/mobxjs/mobx](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mobxjs/mobx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[![NPM](https://nodei.co/npm/mobx-react-lite.png)](https://www.npmjs.com/package/mobx-react-lite)\n\n**You need React version 16.8.0 and above**\n\nThis is a lighter version of [mobx-react](https://github.com/mobxjs/mobx-react) which supports React **functional components only** and as such makes the library slightly faster and smaller (_only 1.5kB gzipped_). In fact `mobx-react@6` has this library as a dependency and builds on top of it.\n\nThe library does not include any Provider/inject utilities as they can be fully replaced with [React Context](https://mobx-react.js.org/recipes-context). Check out [the migration guide](https://mobx-react.js.org/recipes-migration).\n\nClass based components **are not supported** except using `<Observer>` directly in class `render` method. If you want to transition existing projects from classes to hooks, use [mobx-react 6+](https://github.com/mobxjs/mobx-react).\n\nSee more at [the libraries overview](https://mobx-react.js.org/libraries).\n\n## User Guide 👉 https://mobx-react.js.org\n\nThe site contains various examples and recipes for using MobX in React world. Feel free to contribute. The API reference of this package follows 👇.\n\n## API reference ⚒\n\n### **`<Observer>{renderFn}</Observer>`** _([user guide](https://mobx-react.js.org/observer-component))_\n\nIs a React component, which applies observer to an anonymous region in your component.\n\n### **`observer<P>(baseComponent: FunctionComponent<P>, options?: IObserverOptions): FunctionComponent<P>`** _([user guide](https://mobx-react.js.org/observer-hoc))_\n\n```ts\ninterface IObserverOptions {\n    // Pass true to wrap the inner component with React.forwardRef.\n    // It's false by the default.\n    forwardRef?: boolean\n}\n```\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.\n\n### **`useObserver<T>(fn: () => T, baseComponentName = \"observed\", options?: IUseObserverOptions): T`** _([user guide](https://mobx-react.js.org/observer-hook))_\n\n```ts\ninterface IUseObserverOptions {\n    // optional custom hook that should make a component re-render (or not) upon changes\n    useForceUpdate: () => () => void\n}\n```\n\nIt allows you to use an observer like behaviour, but still allowing you to optimize the component in any way you want (e.g. using memo with a custom areEqual, using forwardRef, etc.) and to declare exactly the part that is observed (the render phase).\n\n### **`useLocalStore<T, S>(initializer: () => T, source?: S): T`** _([user guide](https://mobx-react.js.org/state-local))_\n\nLocal observable state can be introduced by using the useLocalStore hook, that runs its initializer function once to create an observable store and keeps it around for a lifetime of a component.\n\n### **`useAsObservableSource<T>(source: T): T`** _([user guide](https://mobx-react.js.org/state-outsourcing))_\n\nThe useAsObservableSource hook can be used to turn any set of values into an observable object that has a stable reference (the same object is returned every time from the hook).\n\n## Observer batching\n\n[Check out the elaborate explanation](https://github.com/mobxjs/mobx-react/pull/787#issuecomment-573599793).\n\nIn short without observer batching the React doesn't guarantee the order component rendering in some cases. We highly recommend that you configure batching to avoid these random surprises.\n\nImport one of these before any React rendering is happening, typically `index.js/ts`. For Jest tests you can utilize [setupFilesAfterEnv](https://jestjs.io/docs/en/configuration#setupfilesafterenv-array).\n\n**React DOM:**\n\n> import 'mobx-react-lite/batchingForReactDom'\n\n**React Native:**\n\n> import 'mobx-react-lite/batchingForReactNative'\n\n### Opt-out\n\nTo opt-out from batching in some specific cases, simply import the following to silence the warning.\n\n> import 'mobx-react-lite/batchingOptOut'\n\n### Custom batched updates\n\nAbove imports are for a convenience to utilize standard versions of batching. If you for some reason have customized version of batched updates, you can do the following instead.\n\n```js\nimport { observerBatching } from \"mobx-react-lite\"\nobserverBatching(customBatchedUpdates)\n```\n","readmeFilename":"README.md","gitHead":"785dc6249de288525753e67b8e4f2663c27e62f9","_id":"mobx-react-lite@2.2.0-beta.0","_nodeVersion":"14.8.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-4i/B5yxXyhgeCy7YLiTWfFR7Vq5FykpsdAg7YYAUTkWbBNfu1I9+xEpCAGf/2kvq7E7lWNEx0MIrFnMTs6R0ew==","shasum":"8182b244c492550a5471a96368ecc6512ad8b5b2","tarball":"http://registry-npm.ywwl.com/mobx-react-lite/download/mobx-react-lite-2.2.0-beta.0.tgz","fileCount":55,"unpackedSize":135171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRWxGCRA9TVsSAnZWagAARGgP/Riu3Yu4RBiamO+k7U+0\n6MXfKYh1kOfExKeed5El8x96GZeGonnUEvHvPG0aVjsjZ7uH9qjCRzD/mmnh\n53szCZLCq2EV/PJNUJ0PBlTpRqIhVbCSUr7ZRj41QthyCjM935VuAGLSOnLp\nVHbrLViZjoxChpgC+BT3dcGu5Zr+GYWNFWYVMlu/UG1MW5LidlvINIszyeeN\n4N/m3hoifQ4plgT5v/gRss0DNlv6lJBhkD14+lpgCETlxsnn+YC/pxV2ufOr\nD5SwbU10k/T1YaMJEzkzd+Hmei41yHXx9eumtt/LumpW9y1gOL4VTUTsi7pa\ny1Bw1Dxz7pwbfQ9wMtFDNHakCP4NeqCauHCGadd9safB0ktBv932MNnuWE7g\n7m0LtOxuqUTYZ681ZDw8ux2PHx+ywMSW53E31rQHYwnnp2s2yCG66LBNzlqH\ndr28jcuVu23UPJ7nMIQkH5fjWuZc4aope5ZIvnqaJ6XHYKoEmMfULmO7MNRy\nbTYC4Ydhq4nWDJNGvehK6fOjwNZjN4W0kYUcUvQy5uAymIGKNUXD/wH+t49J\n7QFlePV6ostsbks3838SDvK+UG3WP8ff5vuBBdpNwjllTQBuV9qatKzEQgS2\nb8yAaH4GJPdQoDAy7tFZkhd90kuDC5XTRrAoMUgGcOJjL5lsBpxmQI/YjKBf\nCM0t\r\n=yUk5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEIxnqHF7lTJhfuvJk6pU4umIT4oSvgiLvTuJ023I/a8AiEAx2mac2tZ/MYkY4IoRCgHiUrQizrqNwcSaJdgk+lFHsU="}],"size":30574,"noattachment":false,"key":"/mobx-react-lite/-/mobx-react-lite-2.2.0-beta.0.tgz"},"maintainers":[{"email":"fredy.c@seznam.cz","name":"fredyc"},{"email":"mweststrate@gmail.com","name":"mweststrate"}],"_npmUser":{"name":"mweststrate","email":"mweststrate@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mobx-react-lite_2.2.0-beta.0_1598385221925_0.40339236465808614"},"_hasShrinkwrap":false,"publish_time":1598385222082,"_cnpm_publish_time":1598385222082,"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"}}