I just asked myself what the reason would be to use styled-components over a custom functional component in react other than saving a few LOC. Example code:
const StyledButton = (props) => (
<button
style={{
color: '#E8E8E8',
padding: '8px 16px',
}}
{...props}
/>
);
const jsx = () => <div><StyledButton>Click Me!</StyledButton></div>;
const StyledButton = styled.button`
color: '#E8E8E8';
padding: '8px 16px';
`;
const jsx = () => <div><StyledButton>Click Me!</StyledButton></div>;
Kind regards,
Thomas
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…