Created
March 25, 2021 15:59
-
-
Save bengrunfeld/200a52b76147edc417230d1d67e12156 to your computer and use it in GitHub Desktop.
Styled Components and Inheritence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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