{"_id":"@arx-snaky/brandi-react","name":"@arx-snaky/brandi-react","dist-tags":{"latest":"5.0.0"},"versions":{"5.0.0":{"name":"@arx-snaky/brandi-react","version":"5.0.0","description":"React bindings for Brandi — the dependency injection container.","main":"./lib/brandi-react.js","module":"./lib/brandi-react.mjs","esnext":"./lib/brandi-react.next.js","esnext:main":"./lib/brandi-react.next.js","esnext:module":"./lib/brandi-react.next.js","exports":{"import":"./lib/brandi-react.mjs","require":"./lib/brandi-react.js","default":"./lib/brandi-react.js"},"typings":"./lib/typings/index.d.ts","sideEffects":false,"scripts":{"test":"jest --colors","build":"npm run clean && npm run build:lib && npm run build:typings","build:lib":"node build.config.js","build:typings":"tsc -p ./tsconfig.typings.json","clean":"rimraf ./lib","code:lint":"prettier --check . && eslint .","code:fix":"prettier --write . && eslint --fix ."},"license":"ISC","author":{"name":"Vladimir Lewandowski","email":"me@vovaspace.com","url":"https://vovaspace.com/"},"homepage":"https://brandi.js.org","repository":{"type":"git","url":"git+https://github.com/BerkliumBirb/brandi.git","directory":"packages/brandi-react"},"bugs":{"url":"https://github.com/vovaspace/brandi/issues"},"keywords":["react","di","ioc","dependency injection","dependency inversion","inversion of control","container"],"peerDependencies":{"brandi":"^3 || ^4","react":"^16.8.0 || ^17 || ^18"},"gitHead":"a554a684fb55ba30fd6ab6ffbae48b311837c8c4","_id":"@arx-snaky/brandi-react@5.0.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-HSpLIdogGef5QYSiiEs2FW0Sniu5bfgmEDxCOf1rzfeFTghm12xE7Tvv+teow/HUYpwRkUZPsrzA6+4RhJFYPw==","shasum":"79b29befaf4ce0fac99f67bad5679f66f2cd2d3f","tarball":"https://registry.npmjs.org/@arx-snaky/brandi-react/-/brandi-react-5.0.0.tgz","fileCount":22,"unpackedSize":35662,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0xz1qdZlonFO+QtOGN4v53aL8tHdQ8YjmfKtKB5dixQIhAKM09qd/0whR6PH01eRcWG50CP/CVL6YtfhrHJ3f7e6J"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyOUuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmph2Q//Q7DCJR3EGQq7K6CtpQrZ44yFaRDgZo+Bm4TTR9t7G0g5umSW\r\n7rdKeesrQ8r9gomoqJiFhp1ypH0nCLbrXmNShFVzbbnRLRlD378lHwOHCvC3\r\nB14r9DVUJcGYn5IqOjVsdpa98DgN+sGLCff8BqjikHb9v8wTiijrK+m6s8GU\r\nEMyv4I96cOIPlBU3RfKj5Rzsc6pDL5wBNZUuBv33OOJuqtcLnUtZnys6H1cY\r\nfZkR6zbndBsrI6NeG8H+v+rXtE3V+o4ocajWdLT52/kBqLK7MAPt6ytNvfa3\r\nuNC8wP1E28aJFWQjWY3StgLrDaYJ0IB8FcnC0S3KWQ6AkC4C3H7Ba5GANzd1\r\nouvoE/3SGwXwKx5OAgKbBdULjR8gYnHwsolylEAL1YlXe1LwrmUZ1iqoy7Wa\r\n47meA+WqaaYfHUTUcP0SjT3sG0w5aGzb1zPIqn615N8Qr5ALV66FfqMPXrNv\r\n6Hs183a7Y27QUyYkwdJYmNDRAIvAfRuM9lGKHN2VZaWlwB0F3iWDYXLHRqgQ\r\nahbcNmtjF4Bm094P/3UjlhdrWCjGqsoO0dhfwjbC9RNdDCncCYUU3EeRcg3b\r\nmpMcA6T8HnI04Y9OJIHtklzrmk5/9vVL2iHJ6aur4E9BzwM9Ok/f5x8CEIAI\r\n++DHJ/ycx43dwXnmbs2Z0wsQQBXn3VIN5k8=\r\n=l2x0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"berklium-birb","email":"berklium-birb@protonmail.com"},"directories":{},"maintainers":[{"name":"berklium-birb","email":"berklium-birb@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/brandi-react_5.0.0_1674110254564_0.5626347690576206"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-19T06:37:34.441Z","5.0.0":"2023-01-19T06:37:34.790Z","modified":"2023-01-19T06:37:34.969Z"},"maintainers":[{"name":"berklium-birb","email":"berklium-birb@protonmail.com"}],"description":"React bindings for Brandi — the dependency injection container.","homepage":"https://brandi.js.org","keywords":["react","di","ioc","dependency injection","dependency inversion","inversion of control","container"],"repository":{"type":"git","url":"git+https://github.com/BerkliumBirb/brandi.git","directory":"packages/brandi-react"},"author":{"name":"Vladimir Lewandowski","email":"me@vovaspace.com","url":"https://vovaspace.com/"},"bugs":{"url":"https://github.com/vovaspace/brandi/issues"},"license":"ISC","readme":"# 🥃 ⚛️ Brandi-React\n\n**Brandi-React** is the React bindings layer\nfor [Brandi](https://github.com/vovaspace/brandi/tree/main/packages/brandi) — the dependency injection container. It lets your React components get dependencies from Brandi containers.\n\n[![License](https://img.shields.io/npm/l/brandi-react.svg)](https://github.com/vovaspace/brandi/blob/main/packages/brandi-react/LICENSE)\n[![NPM Version](https://img.shields.io/npm/v/brandi-react.svg)](https://www.npmjs.com/package/brandi-react)\n[![Minzipped Size](https://img.shields.io/bundlephobia/minzip/brandi-react.svg)](https://bundlephobia.com/result?p=brandi-react)\n\n## Installation\n\nBrandi-React requires **React 16.8 or later**.\nYou'll also need to [install](https://brandi.js.org/getting-started/installation) Brandi.\n\n```bash\n# NPM\nnpm install brandi-react\n```\n\n```bash\n# Yarn\nyarn add brandi-react\n```\n\nThe Brandi-React source code is written in TypeScript but we precompile both CommonJS and ESModule builds to **ES2018**.\n\nAdditionally, we provide builds precompiled to **ESNext** by `esnext`, `esnext:main` and `esnext:module` fields.\n\n**TypeScript** type definitions are **included** in the library and do not need to be installed additionally.\n\n## API Reference\n\n- [`ContainerProvider`](https://brandi.js.org/brandi-react/container-provider) —\n  makes the Brandi container available to any nested components that need to use injections.\n- [`useInjection(token)`](https://brandi.js.org/brandi-react/use-injection) —\n  allows you to get a dependency from a container.\n- [`createInjectionHooks(...tokens)`](https://brandi.js.org/brandi-react/create-injection-hooks) —\n  creates hooks for getting dependencies more easily.\n- [`tagged(...tags)(Component, [options])`](https://brandi.js.org/brandi-react/tagged) —\n  attaches tags to the component and all nested components.\n\nYou can find the full Brandi documentation on the [website](https://brandi.js.org).\n\n## Example\n\n```tsx\n// index.ts\n\nimport { createContainer } from 'brandi';\nimport { ContainerProvider } from 'brandi-react';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { TOKENS } from './tokens';\nimport { ApiService } from './ApiService';\nimport { App } from './App';\n\nconst container = createContainer();\n\ncontainer.bind(TOKENS.apiService).toInstance(ApiService).inTransientScope();\n\nReactDOM.render(\n  <ContainerProvider container={container}>\n    <App />\n  </ContainerProvider>,\n  document.getElementById('root'),\n);\n```\n\n```tsx\n// UserComponent.tsx\n\nimport { useInjection } from 'brandi-react';\nimport { FunctionComponent } from 'react';\n\nimport { TOKENS } from './tokens';\n\nexport const UserComponent: FunctionComponent = () => {\n  const apiService = useInjection(TOKENS.apiService);\n\n  /* ... */\n\n  return (/* ... */);\n}\n```\n","readmeFilename":"README.md"}