react-style-component
v0.0.2
Published
A restyleable base component.
Downloads
9
Readme
react-style-component
A restyleable base component.
status: experimental
what does it do?
Resolves style
and className
using a given strategy
.
In practice, the strategy
could be provided by a generic higher-order component or context providing component.
Implementation matters very little.
general use
import Base from "react-style-component";
<Base />
// => <div />
dynamic component type
<Base component="span" />
// => <span />
const SomeComponent = () => <main />
<Base component={SomeComponent} />
// => <main />
strategy resolution
<Base strategy={{ style: { color: "blue" }, className: "yo" } />
// => <div style="color: blue" className="yo" />
<Base strategy={{ style: null, className: cxs({ color: "blue" }) } />
// => <div className="c-blue"/>