babel-plugin-inject-react-style
v0.0.4
Published
A babel plugin for inject css style into react jsx element!
Downloads
22
Readme
babel-plugin-inject-react-style
A babel plugin for inject css style into react jsx element!
Install
$ yarn add babel-plugin-inject-react-style
Usage
Add setting in .babelrc
:
{
"plugins": ["babel-plugin-inject-react-style"]
}
Example
in
export default function App(): JSX.Element {
return (
<div className="app red">app</div>
);
}
out
import cxLoader from 'babel-plugin-inject-react-style/dist/cx-loader.js';
import styles from './app.css';
const cx = cxLoader(styles);
export default function App(): JSX.Element {
return (
<div className={cx(["app", "red"])}>app</div>
);
}