3 ms·
My first thought for the React example would be to replace the CSS files with styled-components, emotion, or one of the other copycat CSS-in-JS libs with an ide
by crooked-v 8y ago
My first thought for the React example would be to replace the CSS files with styled-components, emotion, or one of the other copycat CSS-in-JS libs with an identical base API.
import { css } from 'emotion';
const WhateverComponent = () => (
<div className={css`
background-color: green;
height: 100%;
`} />
);
export default WhateverComponent;
...or...
import styled from 'react-emotion';
const WhateverComponent = ({ className }) => (
<div className={className} />
);
export default styled(WhateverComponent)`
background-color: green;
height: 100%;
`;
...or...
import styled from 'react-emotion';
const BigGreenBox = styled('div')`
background-color: green;
height: 100%;
`
const WhateverComponent = () => (
<BigGreenBox />
);
export default WhateverComponent;