{"name":"mobx-react-lite","version":"2.0.0-alpha.4","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","repository":{"type":"git","url":"git+https://github.com/mobxjs/mobx-react-lite.git"},"scripts":{"prettier":"prettier --write \"**/*.js\" \"**/*.ts\"","lint":"tslint --project .","validate":"tsc --noEmit","test":"jest --watch","test:ci":"jest -i --coverage && yarn lint","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"},"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":{"@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","coveralls":"3.0.7","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.18.2","react":"16.10.2","react-dom":"16.10.2","react-test-renderer":"16.10.2","rimraf":"3.0.0","size-limit":"2.1.6","ts-jest":"24.1.0","tsdx":"^0.9.1","tslint":"5.20.0","tslint-config-prettier":"1.18.0","typescript":"3.6.4"},"keywords":["mobx","mobservable","react-component","react","reactjs","reactive","hooks","observer","useObserver","useComputer"],"lint-staged":{"*.{ts,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":"5eeea3828e13306a54a25572e26c364dea797735","_id":"mobx-react-lite@2.0.0-alpha.4","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Q72f0DNOhyZ5yg0ylqVLkICsSms2m3HVz6gvyDtFn4QzRpXiIT8kFENxMxGcSYTUsOHw/UeJYH1Qu+IvOkIaWA==","shasum":"e6e4e52dfd2d4d8e8b2d3cdb277a6500172d3770","tarball":"http://registry-npm.ywwl.com/mobx-react-lite/download/mobx-react-lite-2.0.0-alpha.4.tgz","fileCount":681,"unpackedSize":495917,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyIdkCRA9TVsSAnZWagAAmvwP/iaxOMIbvuOFEML9mpgR\nuUStPsRL6bGzOZWu6HW2VuNCdqpWlalco4FCALpleNDUNBJcxlIOKhfc/kV9\nhOhbvthBiQCugMiEs1MzDxp8v2+7o+BIoGPVz6y1YeZcuAOAW29JdYanZ7Gh\nk7IFigBGSlFTQe4ALE58YqoJIwVTfBSomAjQ8IB0ShGIRI53JEaDAVRQrHnb\nRnN897iKF+it9q/83w43wCmTJyhQMex+gm9KsXq7u4SSQfiogeUbQi3DdSKd\niBLMuJzOuiaf9nkUhkpYUcwoKQUH+4RAB+LNlzfCYoRA67uqfcG2to2TkWO9\nZam6rXNHUBg1IDWtm2/N3YNt/yM1zBOoT1+YJhomg86Bf/JSgJwwRBUxX4Mm\n2eF+QQTHRhZuNu4XYBlXz4CCzaY2dkaB7TSrRYibtrnECS2RXMQU+UCWyG2V\nMYBmp+ZSoGdKHdcFmTldmxZMljlL9zohgBl5B+Gy1k4Gp1cxW/fcyjBp6ktg\nvKR5emec2juCikUOv8clHtVxtjOVo5ywl+/edrk8l93f5XCsm3wOfdeNedtX\nyJoDL+ifrywQREWJ4Mt6sFkTmHNRs8hykCnY5543mnhtxKGZT00cVjyDz408\nRI07NYT6MhWDEsaxqXPPb8Rmaorlg+nQ9myIbHAHAB6N+KszDeIKSgMRGc9f\ngF1D\r\n=WCOn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBoqpCcuBSjzIgJt6Vyt2xvJpy6LjiziYs5dv4Eq2WESAiEAgramWcB4TrzUSSG5OoUHzrC3RZqiTd5I8IwDAlSTUik="}],"size":137507,"noattachment":false,"key":"/mobx-react-lite/-/mobx-react-lite-2.0.0-alpha.4.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.4_1573422948148_0.8122296764802601"},"_hasShrinkwrap":false,"publish_time":1573422948315,"_cnpm_publish_time":1573422948315,"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"}}