bem / bem-react

A set of tools for developing user interfaces using the BEM methodology in React
http://bem.github.io/bem-react
Other
440 stars 63 forks source link

@bem-react/di add docs about registries for modifers #451

Open belozer opened 5 years ago

belozer commented 5 years ago

not work

// Block/_mod/Block_mod@desktop
import { withMod as withModBase } from './mod';
import { blockModRegistry } from './Block_mod.registry/desktop';
import { withRegistry } from '@bem-react/di';

export const withMod = withRegistry(blockModRegistry)(withModBase);

Good

// Block/_mod/Block_mod@desktop
import { withMod as withModBase } from './mod';
import { blockModRegistry } from './Block_mod.registry/desktop';
import { withRegistry } from '@bem-react/di';
import { compose } from '@bem-react/core';

export const withMod = compose(withRegistry(blockModRegistry), withModBase);
yarastqt commented 5 years ago

Все верно, withRegistry и withBemMod возвращают не компонент, а ХОК, есть же даже сигнатура в ts про это

belozer commented 5 years ago

@yarastqt да. Я к тому, что в доке это нужно описать (как мне кажется).