Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KIlyaA authored and yarastqt committed Dec 23, 2019
1 parent 29fe115 commit ed044a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/di/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const boldRegistry = new Registry({ id: cnApp(), overridable: false })

## Extending components

You can extend (e.g. for experiments) a component using `withBase(...)`-form in overridden registry.
You can extend (e.g. for experiments) a component using method `extends(...)` in overridden registry.

```tsx
import { Registry, withRegistry, withBase } from '@bem-react/di'
Expand All @@ -228,14 +228,14 @@ import { AppDesktop, registryId } from './App@desktop'
const expRegistry = new Registry({ id: registryId })

// extends original Header
expRegistry.set('Header', withBase(BaseHeader => props => (
expRegistry.extends('Header', BaseHeader => props => (
<div>
<BaseHeader height={200} color={red}/>
</div>
)))
))

// AppDesktopExperimental will call App with extended 'Header'
export const AppDesktopExperimental = withRegistry(expRegistry)(AppDesktop)
```

_DI_ merges nested registries composing withBase-forms and ordinary components for you. So you always can get a reference to previous component's implementation.
_DI_ merges nested registries composing and ordinary components for you. So you always can get a reference to previous component's implementation.

0 comments on commit ed044a3

Please sign in to comment.