Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Created March 25, 2021 15:59
Show Gist options
  • Save bengrunfeld/200a52b76147edc417230d1d67e12156 to your computer and use it in GitHub Desktop.
Save bengrunfeld/200a52b76147edc417230d1d67e12156 to your computer and use it in GitHub Desktop.
Styled Components and Inheritence
// GenericButton.styles.js
export const GenericButton = styled.button`
width: 90%;
`
// SubmitButton.styles.js
import { GenericButton } from '../GenericButton.styles'
// This components inherits the styles of GenericButton
export const SubmitFormButton = styled(GenericButton)`
background: red;
`
// SubmitButton.jsx
import { SubmitFormButton } from './SubmitButton.styles.js'
const SubmitButton = () => <SubmitFormButton active={active}>Click me</SubmitFormButton>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment