0.5.0 • Published 5 years ago
retagger v0.5.0
npm install retagger
# or
yarn add retagger
Examples
import Retagger from 'retagger';
const Container = Retagger.div.Container;
// <div className="Container" {...restProps} />
function MyComponent() {
return (
// Accept any other props
<Container role="presentation">
<OtherComponent />
</Container>
);
}
import Retagger from 'retagger';
const Container = Retagger.div.Container.OtherClass.foo;
// <div className="Container OtherClass foo" {...restProps} />
function MyComponent() {
return (
<Container>
<OtherComponent />
</Container>
);
}
import Retagger from 'retagger';
const classes = {
container: '__foo',
};
const Container = Retagger.div[classes.container].OtherClass.foo;
// <div className="__foo OtherClass foo" {...restProps} />
function MyComponent() {
return (
<Container>
<OtherComponent />
</Container>
);
}
import Retagger from 'retagger';
const Container = Retagger(YourComponent).Container.foo;
// YourComponent should accept className prop
// <YourComponent className="Container foo" {...restProps} />
function MyComponent() {
return (
<Container>
<OtherComponent />
</Container>
);
}
See LICENSE for more information.