{"name":"mobx-react-lite","version":"2.0.0-alpha.5","description":"Lightweight React bindings for MobX based on React 16.8 and Hooks","main":"dist/index.js","typings":"dist/index.d.ts","types":"dist/index.d.ts","jsnext:main":"dist/mobxreactlite.esm.js","module":"dist/mobxreactlite.esm.js","unpkg":"dist/mobxreactlite.umd.production.min.js","react-native":"dist/mobxreactlite.esm.js","sideEffects":false,"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","build":"yarn bundle","bundle":"tsdx build --name mobxReactLite --format=cjs,esm,umd --tsconfig tsconfig.build.json","prepublishOnly":"yarn build","dedup":"npx yarn-deduplicate -s fewer yarn.lock","nextVersion":"npm version prerelease --preid alpha","nextPublish":"nextVersion && npm publish --tag next"},"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"},"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","lint-staged":"9.4.2","mobx":"5.14.0","prettier":"^1.19.1","react":"16.10.2","react-dom":"16.10.2","react-test-renderer":"16.10.2","rimraf":"3.0.0","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","useComputer"],"lint-staged":{"*.{ts,tsx,js}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-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## Optimize rendering\n\n[Check out the elaborate explanation](https://github.com/mobxjs/mobx-react-lite/issues/153#issuecomment-490511464).\n\nIf this is something that concerns you, we have prepared files you can simply import to configure MobX to use React batched updates depending on your platform.\n\n**React DOM:**\n\n> import 'mobx-react-lite/optimizeForReactDom'\n\n**React Native:**\n\n> import 'mobx-react-lite/optimizeForReactNative'\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### Custom batched updates\n\nAbove imports are for a convenience. If you for some reason have customized version of batched updates, you can do the following instead.\n\n```js\nimport { optimizeScheduler } from \"mobx-react-lite\"\noptimizeScheduler(customBatchedUpdates)\n```\n","readmeFilename":"README.md","gitHead":"c012a66ce45526dcd3f01be50a064c82346cb396","_id":"mobx-react-lite@2.0.0-alpha.5","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-V5O6nPZY6efnaoGE62Y+FxmwJrT/AgHE84UDt5QGXgRBNMZDM6ep4qaHWRilZKkvRAcV0x+ktslXmYPF7NBXmA==","shasum":"059c39d2932efa298d44f6f748eb9a96957b3c56","tarball":"http://registry-npm.ywwl.com/mobx-react-lite/download/mobx-react-lite-2.0.0-alpha.5.tgz","fileCount":39,"unpackedSize":195797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSXOlCRA9TVsSAnZWagAA4rsP+wXLGX7ZB4SfG7VmBhCS\nsv1lb8u9c6UIT6A1whxqQRJ6OLghAF+BplT7t0jZUq2gLwi/WZL/tQtMtp1r\nG4Z9NvSvQCu2Q6yUCIRywKS4rvUCB604PdauJFk9z6Qf6bmXrqO5Sb9ThqLf\nc5RO+OBP1WkH+wps6UaM3U2Sjy/4TTMAl3e0RkcXsp5/xHwUsmx5hqOl9R8B\noo62PDAlXTwSbBz/aUfaXdlvMlfDfddTwd5utGME6ACN/mwNrUI/siBeTSZr\nsyXMofh9mwQI9IZuiUUXDWAXhd9yTCS0Wi2S4uL3HOagyrxtTtxIZ1dOrsIy\ncNnybM8Xyiz9qFxWIX4MbzXIX4FWifOoRh0jyVOtyowWVgyNB4lRzKhXxssL\nLuU4rVSZ8UWI7ehMsRdyqSW7F1VK9sbLFpXIh4eczQBhaH1HODEkM3rBrV0s\nWZezwFguvixQ+PN9yrPZqhVGGURvvtghpXX13f/FS0yBkLL9Hi3qEPkdUH5B\nW1CAYcne5H2sBU+2acI1cAc26Lo9eOAWlgXDIJQeTFjiR9gPxoxg/ckfDvGI\nYvwPt286b0IRNMDlGIfDb/muRCtbe/8apJwny07PosOuLlLaoKQXHzsX0Q7b\nTaA7tP7jaJZPlqX9HJxB/0hyaNaY5O+DRN+yzZRCPF6ewCwKraKYYd9M9TC1\njMng\r\n=RT3Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFYcFYHYM5aFnkiP/GtuBlUxjDxSR3XiYQspvFA1rSZEAiA1bpqHQIvy6ufOeXbmkWsFiaT74zjf6Gfr/bMQWyblBg=="}],"size":51028,"noattachment":false,"key":"/mobx-react-lite/-/mobx-react-lite-2.0.0-alpha.5.tgz"},"maintainers":[{"name":"fredyc","email":"fredy.c@seznam.cz"}],"_npmUser":{"name":"fredyc","email":"fredy.c@seznam.cz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mobx-react-lite_2.0.0-alpha.5_1581872036884_0.7050636630103888"},"_hasShrinkwrap":false,"publish_time":1581872036987,"_cnpm_publish_time":1581872036987,"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"}}