@bem-react/di
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.0.3](https://github.com/bem/bem-react/compare/@bem-react/di@2.0.2...@bem-react/di@2.0.3) (2019-08-20) | ||
**Note:** Version bump only for package @bem-react/di | ||
## [2.0.2](https://github.com/bem/bem-react/compare/@bem-react/di@2.0.1...@bem-react/di@2.0.2) (2019-07-31) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@bem-react/di", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "BEM React Dependency Injection", | ||
@@ -51,3 +51,3 @@ "homepage": "https://github.com/bem/bem-react/tree/master/packages/di", | ||
}, | ||
"gitHead": "85ac37ac16d19119736bcb7248991efe68e04e05" | ||
"gitHead": "dcf835fb625cea899f1f5b36eebf74dca439d092" | ||
} |
@@ -57,8 +57,16 @@ # @bem-react/di · [![npm (scoped)](https://img.shields.io/npm/v/@bem-react/di.svg)](https://www.npmjs.com/package/@bem-react/di) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@bem-react/di.svg)](https://bundlephobia.com/result?p=@bem-react/di) | ||
**1.** In `App@desktop.tsx` | ||
**1.** In `App.tsx` | ||
```tsx | ||
import { cn } from '@bem-react/classname'; | ||
export const cnApp = cn('App'); | ||
export const registryId = cnApp(); | ||
``` | ||
**2.** In `App@desktop.tsx` | ||
```tsx | ||
import { Registry, withRegistry } from '@bem-react/di'; | ||
import { App as AppCommon } from './App'; | ||
import { App as AppCommon, registryId } from './App'; | ||
@@ -68,6 +76,4 @@ import { Footer } from './Components/Footer/Footer@desktop'; | ||
const cnApp = cn('App'); | ||
export const registry = new Registry({ id: registryId }); | ||
const registry = new Registry({ id: cnApp() }); | ||
registry.set('Header', Header); | ||
@@ -79,8 +85,7 @@ registry.set('Footer', Footer); | ||
**2.** In `App@mobile.tsx` | ||
**3.** In `App@mobile.tsx` | ||
```tsx | ||
import { cn } from '@bem-react/classname'; | ||
import { Registry, withRegistry } from '@bem-react/di'; | ||
import { App as AppCommon } from './App'; | ||
import { App as AppCommon, registryId } from './App'; | ||
@@ -90,6 +95,4 @@ import { Footer } from './Components/Footer/Footer@mobile'; | ||
const cnApp = cn('App'); | ||
export const registry = new Registry({ id: registryId }); | ||
const registry = new Registry({ id: cnApp() }); | ||
registry.set('Header', Header); | ||
@@ -140,3 +143,3 @@ registry.set('Footer', Footer); | ||
)} | ||
</RegistryConsumer> | ||
</ComponentRegistryConsumer> | ||
); | ||
@@ -182,9 +185,9 @@ ``` | ||
import { AppDesktop } from './App@desktop'; | ||
import { AppDesktop, registryId } from './App@desktop'; | ||
import { HeaderExperimental } from './experiments/Components/Header/Header'; | ||
const expRegistry = new Registry({ id: cnApp() }); | ||
const expRegistry = new Registry({ id: registryId }); | ||
// replacing original Header with HeaderExperimental | ||
registry.set('Header', HeaderExperimental); | ||
expRegistry.set('Header', HeaderExperimental); | ||
@@ -191,0 +194,0 @@ // AppDesktopExperimental will call App with HeaderExperimental as 'Header' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21126
199