Created
March 25, 2021 15:57
-
-
Save bengrunfeld/b37859c30c54140e4be06dfd20dad828 to your computer and use it in GitHub Desktop.
Variable Injection in Styled Components
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
// SubmitButton.styles.js | |
export const SubmitFormButton = styled.button` | |
background: ${({active}) => active ? "blue" : "red"}; | |
` | |
// SubmitButton.jsx | |
import { SubmitFormButton } from './SubmitButton.styles.js' | |
const SubmitButton = () => <SubmitFormButton active={true}>Click me</SubmitFormButton> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment