Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Created March 25, 2021 15:57
Show Gist options
  • Save bengrunfeld/b37859c30c54140e4be06dfd20dad828 to your computer and use it in GitHub Desktop.
Save bengrunfeld/b37859c30c54140e4be06dfd20dad828 to your computer and use it in GitHub Desktop.
Variable Injection in Styled Components
// 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